Skip to content

Commit

Permalink
topo: clean outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmuller committed Jun 13, 2024
1 parent ef7ae43 commit 29e959f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 45 deletions.
13 changes: 5 additions & 8 deletions MMVII/src/Topo/Topo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ void cMMVII_BundleAdj::InitItereTopo()
{
if (mTopo)
{
std::cout<<"cMMVII_BundleAdj::InitItereTopo\n";
mTopo->FromData(mVGCP, mPhProj);
mTopo->AddToSys(mSetIntervUK); //after all is created
}
Expand Down Expand Up @@ -60,7 +59,6 @@ cBA_Topo::cBA_Topo

cBA_Topo::~cBA_Topo()
{
//std::cout<<"delete cBA_Topo"<<std::endl;
clear();
for (auto& [_, aEq] : mTopoObsType2equation)
delete aEq;
Expand Down Expand Up @@ -157,12 +155,12 @@ void cBA_Topo::FromData(const std::vector<cBA_GCP *> & vGCP, cPhotogrammetricPro

void cBA_Topo::print()
{
std::cout<<"Points:\n";
StdOut() << "Points:\n";
for (auto& [aName, aPtT] : mAllPts)
std::cout<<" - "<<aPtT.toString()<<"\n";
std::cout<<"ObsSets:\n";
StdOut() << " - "<<aPtT.toString()<<"\n";
StdOut() << "ObsSets:\n";
for (auto &obsSet: mAllObsSets)
std::cout<<" - "<<obsSet->toString()<<"\n";
StdOut() << " - "<<obsSet->toString()<<"\n";
printObs(false);
}

Expand Down Expand Up @@ -250,7 +248,6 @@ void cBA_Topo::AddTopoEquations(cResolSysNonLinear<tREAL8> & aSys)
for (size_t i=0;i<obsSet->nbObs();++i)
{
cTopoObs* obs = obsSet->getObs(i);
std::cout<<"add eq: "<<obs->toString()<<" ";
auto equation = getEquation(obs->getType());
aSys.CalcAndAddObs(equation, obs->getIndices(), obs->getVals(), obs->getWeights());
#ifdef VERBOSE_TOPO
Expand Down Expand Up @@ -299,7 +296,7 @@ void BenchTopoComp1example(const std::pair<cTopoData, cSetMesGCP>& aBenchData, t
aMesGCPtmp.AddMes2D(aSetMesIm);
cSetMesImGCP * aMesGCP = aMesGCPtmp.FilterNonEmptyMeasure(0);

aBA.AddGCP("topo", 1., {}, aMesGCP);
aBA.AddGCP("topo", 1., {}, aMesGCP, false);

for (int aKIter=0 ; aKIter<aNbIter ; aKIter++)
{
Expand Down
2 changes: 0 additions & 2 deletions MMVII/src/Topo/ctopodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace MMVII

void cTopoObsData::AddData(const cAuxAr2007 & anAuxInit)
{
//std::cout<<"Add data obs '"<<toString()<<"'"<<std::endl;
cAuxAr2007 anAux("TopoObsData",anAuxInit);

MMVII::EnumAddData(anAux,mType,"Type");
Expand All @@ -35,7 +34,6 @@ void AddData(const cAuxAr2007 & anAux, cTopoObsData & aTopoObs)
void cTopoObsSetData::AddData(const cAuxAr2007 & anAuxInit)
{
cAuxAr2007 anAux("TopoObsSetData",anAuxInit);
//std::cout<<"Add data obs set '"<<toString()<<"'"<<std::endl;
MMVII::EnumAddData(anAux,mType,"Type");
MMVII::AddData(cAuxAr2007("AllObs",anAux),mObs);

Expand Down
2 changes: 0 additions & 2 deletions MMVII/src/Topo/ctopoobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ cTopoObs::cTopoObs(cTopoObsSet* set, cBA_Topo *aBA_Topo, eTopoObsType type, cons
case eTopoObsType::eNbVals:
MMVII_INTERNAL_ERROR("unknown obs type")
}
//std::cout<<"DEBUG: create cTopoObs "<<toString()<<"\n";

}

std::string cTopoObs::toString() const
Expand Down
42 changes: 12 additions & 30 deletions MMVII/src/Topo/ctopoobsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ cTopoObsSet::cTopoObsSet(cBA_Topo * aBA_Topo, eTopoObsSetType type):

cTopoObsSet::~cTopoObsSet()
{
//std::cout<<"delete set"<<std::endl;
std::for_each(mObs.begin(), mObs.end(), [](auto o){ delete o; });
}


void cTopoObsSet::AddToSys(cSetInterUK_MultipeObj<tREAL8> & aSet)
{
#ifdef VERBOSE_TOPO
//std::cout<<"AddToSys set "<<this<<std::endl;
#endif
PutUknowsInSetInterval();
}

Expand All @@ -38,9 +34,6 @@ void cTopoObsSet::create()

void cTopoObsSet::PutUknowsInSetInterval()
{
#ifdef VERBOSE_TOPO
//std::cout<<"PutUknowsInSetInterval set "<<this<<std::endl;
#endif
if (!mParams.empty())
mSetInterv->AddOneInterv(mParams);
}
Expand Down Expand Up @@ -95,10 +88,6 @@ cTopoObsSetStation::cTopoObsSetStation(cBA_Topo *aBA_Topo) :
void cTopoObsSetStation::PutUknowsInSetInterval()
{
cTopoObsSet::PutUknowsInSetInterval();

#ifdef VERBOSE_TOPO
std::cout<<"PutUknowsInSetInterval setStation "<<this<<std::endl;
#endif
}


Expand All @@ -115,9 +104,6 @@ void cTopoObsSetStation::AddToSys(cSetInterUK_MultipeObj<tREAL8> & aSet)
{
cTopoObsSet::AddToSys(aSet);

#ifdef VERBOSE_TOPO
std::cout<<"AddToSys SetStation mRotOmega "<<&mRotOmega<<std::endl;
#endif
aSet.AddOneObj(&mRotOmega);
aSet.AddOneObj(this); // to have OnUpdate called on SetVUnKnowns
}
Expand All @@ -133,7 +119,7 @@ void cTopoObsSetStation::OnUpdate()
// update mRotSysCo2Vert with new station position
mRotSysCo2Vert = mBA_Topo->getSysCo()->getVertical(*mPtOrigin->getPt());

//std::cout<<" OnUpdate mRotOmega: "<<mRotOmega.Pt()<<"\n";
//StdOut() << " OnUpdate mRotOmega: "<<mRotOmega.Pt()<<"\n";

// now this have modified rotation, the "delta" is void:
mRotOmega.Pt() = cPt3dr(0,0,0);
Expand Down Expand Up @@ -162,10 +148,6 @@ std::string cTopoObsSetStation::toString() const
oss<<" "<<mRotSysCo2Vert.AxeJ()<<"\n";
oss<<" "<<mRotSysCo2Vert.AxeK()<<"\n";

/*std::cout<<"cTopoObsSetStation rot:\n";
std::cout<<" "<<mRotSysCo2Vert.AxeI()<<" "<<mRotVert2Instr.AxeI()<<" "<<(mRotSysCo2Vert * mRotVert2Instr).AxeI()<<"\n";
std::cout<<" "<<mRotSysCo2Vert.AxeJ()<<" * "<<mRotVert2Instr.AxeJ()<<" = "<<(mRotSysCo2Vert * mRotVert2Instr).AxeJ()<<"\n";
std::cout<<" "<<mRotSysCo2Vert.AxeK()<<" "<<mRotVert2Instr.AxeK()<<" "<<(mRotSysCo2Vert * mRotVert2Instr).AxeK()<<"\n";*/
return cTopoObsSet::toString() + oss.str();
}

Expand All @@ -179,17 +161,17 @@ void cTopoObsSetStation::makeConstraints(cResolSysNonLinear<tREAL8> & aSys)
case(eTopoStOriStat::eTopoStOriFixed):
mRotOmega.Pt() = {0.,0.,0.};
#ifdef VERBOSE_TOPO
std::cout<<"Freeze rotation for "<<&mRotOmega<<std::endl;
std::cout<<" rotation indices "<<mRotOmega.IndUk0()<<"-"<<mRotOmega.IndUk1()-1<<std::endl;
StdOut() << "Freeze rotation for "<<&mRotOmega<<std::endl;
StdOut() << " rotation indices "<<mRotOmega.IndUk0()<<"-"<<mRotOmega.IndUk1()-1<<std::endl;
#endif
aSys.SetFrozenVarCurVal(mRotOmega,mRotOmega.Pt());
//for (int i=mRotOmega.IndUk0()+3;i<mRotOmega.IndUk1();++i)
// aSys.AddEqFixCurVar(i,0.001);
break;
case(eTopoStOriStat::eTopoStOriVert):
#ifdef VERBOSE_TOPO
std::cout<<"Freeze bascule for "<<&mRotOmega<<std::endl;
std::cout<<" rotation indices "<<mRotOmega.IndUk0()<<"-"<<mRotOmega.IndUk1()-2<<std::endl;
StdOut() << "Freeze bascule for "<<&mRotOmega<<std::endl;
StdOut() << " rotation indices "<<mRotOmega.IndUk0()<<"-"<<mRotOmega.IndUk1()-2<<std::endl;
#endif
aSys.SetFrozenVarCurVal(mRotOmega,mRotOmega.Pt().PtRawData(), 2); // not z
//for (int i=mRotOmega.IndUk0()+3;i<mRotOmega.IndUk1()-1;++i)
Expand All @@ -207,7 +189,7 @@ void cTopoObsSetStation::makeConstraints(cResolSysNonLinear<tREAL8> & aSys)
bool cTopoObsSetStation::initialize()
{
#ifdef VERBOSE_TOPO
std::cout<<"cTopoObsSetStation::initialize "<<mOriginName<<std::endl;
StdOut() << <<"cTopoObsSetStation::initialize "<<mOriginName<<std::endl;
#endif

// auto fix mStationIsOriented if has orientation obs
Expand Down Expand Up @@ -283,11 +265,11 @@ bool cTopoObsSetStation::initialize()
{
mRotVert2Instr = cRotation3D<tREAL8>::RotFromAxiator({0., 0., G0});
#ifdef VERBOSE_TOPO
std::cout<<"Init G0: "<<G0<<std::endl;
std::cout<<"Init mRotVert2Instr:\n";
std::cout<<" "<<mRotVert2Instr.AxeI()<<"\n";
std::cout<<" "<<mRotVert2Instr.AxeJ()<<"\n";
std::cout<<" "<<mRotVert2Instr.AxeK()<<"\n";
StdOut() << "Init G0: "<<G0<<std::endl;
StdOut() << "Init mRotVert2Instr:\n";
StdOut() << " "<<mRotVert2Instr.AxeI()<<"\n";
StdOut() << " "<<mRotVert2Instr.AxeJ()<<"\n";
StdOut() << " "<<mRotVert2Instr.AxeK()<<"\n";
#endif
return true;
}
Expand All @@ -309,7 +291,7 @@ bool cTopoObsSetStation::initialize()
void cTopoObsSetStation::setOrigin(std::string _OriginName)
{
#ifdef VERBOSE_TOPO
std::cout<<"cTopoObsSetStation::setOrigin "<<_OriginName<<std::endl;
StdOut() << "cTopoObsSetStation::setOrigin "<<_OriginName<<std::endl;
#endif
mPtOrigin = &mBA_Topo->getPoint(_OriginName);
mOriginName = _OriginName;
Expand Down
6 changes: 3 additions & 3 deletions MMVII/src/Topo/ctopopoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cTopoPoint::cTopoPoint() :
void cTopoPoint::findUK(const std::vector<cBA_GCP *> & vGCP, cPhotogrammetricProject *aPhProj, const cPt3dr & aCoordIfPureTopo)
{
#ifdef VERBOSE_TOPO
std::cout<<"findOrMakeUK "<<mName<<": ";
StdOut() << "findOrMakeUK "<<mName<<": ";
#endif
MMVII_INTERNAL_ASSERT_strong(!isReady(), "double cTopoPoint::findOrMakeUK for point "+mName);

Expand All @@ -46,7 +46,7 @@ void cTopoPoint::findUK(const std::vector<cBA_GCP *> & vGCP, cPhotogrammetricPro
mPt = &gcp->mGCP_UK.at(i)->Pt(); //< use existing unknown if available
mInitCoord = *mPt;
#ifdef VERBOSE_TOPO
std::cout<<"is a GCP with existing unknowns\n";
StdOut() << "is a GCP with existing unknowns\n";
#endif
return;
} else {
Expand All @@ -68,7 +68,7 @@ void cTopoPoint::findUK(const std::vector<cBA_GCP *> & vGCP, cPhotogrammetricPro
mPt = &aCam->Center();
mInitCoord = *mPt;
#ifdef VERBOSE_TOPO
std::cout<<"is a camera\n";
StdOut() << "is a camera\n";
#endif
return;
}
Expand Down

0 comments on commit 29e959f

Please sign in to comment.