1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357 |
- /* This file is part of Lemma, a geophysical modelling and inversion API */
-
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- /**
- @file
- @author Trevor Irons
- @date 12/02/2009
- **/
-
- #include "DipoleSource.h"
- #include "KernelEM1DManager.h"
-
- //#include "GroundedElectricDipole.h"
- //#include "UngroundedElectricDipole.h"
- //#include "MagneticDipole.h"
-
- #include "FieldPoints.h"
- #include "HankelTransform.h"
-
- namespace Lemma {
-
-
- // ==================== FRIENDS ======================
-
- std::ostream &operator<<(std::ostream &stream, const DipoleSource &ob) {
- stream << ob.Serialize() << "\n";
- return stream;
- }
-
- /*
- bool DipoleSource::operator == (DipoleSource& rhs) const {
- if (Location != rhs.Location) return false;
- return true;
- }
- */
-
- // ==================== LIFECYCLE ======================
-
- DipoleSource::DipoleSource( const ctor_key& key ) : LemmaObject( key ),
- Type(NOSOURCETYPE),
- irec(-1),
- Phase(0),
- Moment(1),
- KernelManager(nullptr),
- Receivers(nullptr),
- Earth(nullptr)
- {
- this->Location.setZero();
- this->Phat.setZero();
- }
-
- DipoleSource::DipoleSource( const YAML::Node& node, const ctor_key& key ) : LemmaObject( node, key ),
- Type(NOSOURCETYPE),
- irec(-1),
- Phase(0),
- Moment(1),
- KernelManager(nullptr),
- Receivers(nullptr),
- Earth(nullptr)
- {
- Type = string2Enum<DIPOLESOURCETYPE>(node["Type"].as<std::string>());
- this->Location = node["Location"].as<Vector3r>();
- this->Phat.setZero();
- }
-
-
- DipoleSource::~DipoleSource() {
- }
-
- std::shared_ptr<DipoleSource> DipoleSource::NewSP() {
- return std::make_shared<DipoleSource> ( ctor_key() );
- }
-
- YAML::Node DipoleSource::Serialize() const {
- YAML::Node node = LemmaObject::Serialize();
- node.SetTag( GetName() );
- node["Type"] = enum2String(Type);
- node["Location"] = Location;
- node["Phat"] = Phat;
- node["Freqs"] = Freqs;
- node["Phase"] = Phase;
- node["Moment"] = Moment;
- return node;
- }
-
- std::shared_ptr< DipoleSource > DipoleSource::DeSerialize(const YAML::Node& node) {
- if (node.Tag() != "DipoleSource") {
- throw DeSerializeTypeMismatch( "DipoleSource", node.Tag());
- }
- return std::make_shared<DipoleSource> ( node, ctor_key() );
- }
-
- std::shared_ptr<DipoleSource> DipoleSource::Clone() {
-
- auto Obj = DipoleSource::NewSP();
-
- // copy
- Obj->Type = Type;
-
- Obj->irec = irec;
- Obj->lays = lays;
- Obj->layr = layr;
-
- Obj->Phase = Phase;
- Obj->Moment = Moment;
-
- Obj->xxp = xxp;
- Obj->yyp = yyp;
- Obj->rho = rho;
- Obj->sp = sp;
- Obj->cp = cp;
- Obj->scp = scp;
- Obj->sps = sps;
- Obj->cps = cps;
- Obj->c2p = c2p;
-
- Obj->FieldsToCalculate = FieldsToCalculate;
- Obj->f = f;
- Obj->ik = ik;
-
- Obj->Location = Location;
- Obj->Phat = Phat;
- Obj->Freqs = Freqs;
-
- return Obj;
- }
-
- //--------------------------------------------------------------------------------------
- // Class: DipoleSource
- // Method: GetName
- // Description: Class identifier
- //--------------------------------------------------------------------------------------
- inline std::string DipoleSource::GetName ( ) const {
- return CName;
- } // ----- end of method DipoleSource::GetName -----
-
- // ==================== ACCESS ======================
- void DipoleSource::SetLocation(const Vector3r &posin) {
- this->Location = posin;
- }
-
- void DipoleSource::SetLocation(const Real &xp, const Real &yp,
- const Real &zp) {
- this->Location = Vector3r(xp, yp, zp);
- }
-
- void DipoleSource::SetPhase(const Real &phase) {
- this->Phase = phase;
- }
-
- void DipoleSource::SetPolarity(const DipoleSourcePolarity &pol) {
- static bool called = false;
- if (!called) {
- std::cerr << "\n\n=================================================================\n"
- << "WARNING: Use of deprecated method DipoleSource::SetPolarity(pol)\n"
- << "Use more general SetPolarisation( Vector3r ) or SetPolarisation( x, y, z );\n"
- << "This method will be removed in future versions of Lemma"
- << "\n=================================================================\n";
- called = true;
- }
- // Polarity = pol;
- // switch (Polarity) {
- // case POSITIVE:
- // Moment = std::abs(Moment);
- // break;
- // case NEGATIVE:
- // Moment = -std::abs(Moment);
- // break;
- // default:
- // throw NonValidDipolePolarity();
- // };
- }
-
- void DipoleSource::SetType(const DIPOLESOURCETYPE & stype) {
-
- switch (stype) {
- case (GROUNDEDELECTRICDIPOLE):
- this->Type = stype;
- break;
- case (UNGROUNDEDELECTRICDIPOLE):
- this->Type = stype;
- break;
- case (MAGNETICDIPOLE):
- this->Type = stype;
- break;
- default:
- throw NonValidDipoleTypeAssignment();
- }
- }
-
- void DipoleSource::SetPolarisation(const Vector3r& pol) {
- this->Phat = pol / pol.norm();
- }
-
- void DipoleSource::SetPolarisation(const Real& x, const Real& y, const Real& z) {
- Vector3r pol = (VectorXr(3) << x, y, z).finished();
- this->Phat = pol / pol.norm();
- }
-
- Vector3r DipoleSource::GetPolarisation() {
- return Phat;
- }
-
- DIPOLESOURCETYPE DipoleSource::GetType() {
- return Type;
- }
-
- void DipoleSource::SetPolarisation(const
- DipoleSourcePolarisation &pol) {
-
- static bool called = false;
- if (!called) {
- std::cout << "\n\n========================================================================================\n"
- << "WARNING: Use of deprecated method DipoleSource::SetPolarisation(DipleSourcePolarisation)\n"
- << "Use more general SetPolarisation( Vector3r ) or SetPolarisation( x, y, z );\n"
- << "This method will be removed in future versions of Lemma"
- << "\n========================================================================================\n";
- called = true;
- }
-
- switch (pol) {
- case (XPOLARISATION):
- this->Phat = (VectorXr(3) << 1, 0, 0).finished();
- break;
- case (YPOLARISATION):
- this->Phat = (VectorXr(3) << 0, 1, 0).finished();
- break;
- case (ZPOLARISATION):
- this->Phat = (VectorXr(3) << 0, 0, 1).finished();
- break;
- default:
- throw NonValidDipolePolarisationAssignment();
- }
- }
-
- void DipoleSource::SetMoment(const Real &moment) {
- this->Moment = moment;
- }
-
- // ==================== OPERATIONS =====================
-
- void DipoleSource::SetKernels(const int& ifreq, const FIELDCALCULATIONS& Fields , std::shared_ptr<FieldPoints> ReceiversIn, const int& irecin,
- std::shared_ptr<LayeredEarthEM> EarthIn ) {
-
- if (Receivers != ReceiversIn) {
- Receivers = ReceiversIn;
- }
- if (Earth != EarthIn) {
- Earth = EarthIn;
- }
- if (irecin != irec) {
- irec = irecin;
- }
- if (FieldsToCalculate != Fields) {
- FieldsToCalculate = Fields;
- }
-
- xxp = Receivers->GetLocation(irec)[0] - Location[0];
- yyp = Receivers->GetLocation(irec)[1] - Location[1];
- rho = (Receivers->GetLocation(irec).head<2>() - Location.head<2>()).norm();
-
- sp = yyp/rho;
- cp = xxp/rho;
- scp = sp*cp;
- sps = sp*sp;
- cps = cp*cp;
- c2p = cps-sps;
-
- f = VectorXcr::Zero(13);
- ik = VectorXi::Zero(13);
-
- lays = Earth->GetLayerAtThisDepth(Location[2]);
- layr = Earth->GetLayerAtThisDepth(Receivers->GetLocation(irec)[2]);
-
- // TODO, avoid smart pointer here maybe?
- KernelManager = KernelEM1DManager::NewSP();
-
- KernelManager->SetEarth(Earth);
- // alternative is to use weak_ptr here, this is deep and internal, and we are safe.
- //KernelManager->SetDipoleSource( shared_from_this().get() , ifreq, Receivers->GetLocation(irec)[2]);
- KernelManager->SetDipoleSource( this, ifreq, Receivers->GetLocation(irec)[2]);
-
- //KernelManager->SetDipoleSource( this.get() , ifreq, Receivers->GetLocation(irec)[2] );
- kernelFreq = Freqs(ifreq); // this is never used
-
- ReSetKernels( ifreq, Fields, Receivers, irec, Earth );
-
- return;
- }
-
- void DipoleSource::SetupLight(const int& ifreq, const FIELDCALCULATIONS& Fields, const int& irecin) {
-
- xxp = Receivers->GetLocation(irec)[0] - Location[0];
- yyp = Receivers->GetLocation(irec)[1] - Location[1];
- rho = (Receivers->GetLocation(irec).head<2>() - Location.head<2>()).norm();
-
- sp = yyp/rho;
- cp = xxp/rho;
- scp = sp*cp;
- sps = sp*sp;
- cps = cp*cp;
- c2p = cps-sps;
-
- return;
- }
-
-
-
- // TODO we could make the dipoles template specializations avoiding this rats nest of switch statements. Probably
- // not the most critical piece though
- void DipoleSource::ReSetKernels(const int& ifreq, const FIELDCALCULATIONS& Fields ,
- std::shared_ptr<FieldPoints> Receivers, const int& irec,
- std::shared_ptr<LayeredEarthEM> Earth ) {
-
- Vector3r Pol = Phat;
-
- switch (Type) {
-
- case (GROUNDEDELECTRICDIPOLE):
-
- if (std::abs(Pol[2]) > 0) { // z dipole
-
- switch(FieldsToCalculate) {
-
- case E:
- if (lays == 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INAIR, INAIR>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INAIR, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INGROUND, INAIR>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INAIR>( );
- } else {
- ik[10] = KernelManager->AddKernel<TM, 10, INGROUND, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
- if (lays == 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INAIR>( );
- } else {
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INGROUND>( );
- }
- break;
-
-
- case BOTH:
- if ( lays == 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INAIR, INAIR>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INAIR>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INAIR, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INGROUND>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TM, 10, INGROUND, INAIR>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INAIR>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INAIR>( );
- } else {
- ik[10] = KernelManager->AddKernel<TM, 10, INGROUND, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INGROUND>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INGROUND>( );
- }
- }
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y grounded HED dipole
-
- switch(FieldsToCalculate) {
-
- case E:
- if ( lays == 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INAIR, INAIR>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INAIR, INAIR>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INAIR, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INAIR, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INAIR, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INAIR, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INGROUND, INAIR>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INGROUND, INAIR>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INGROUND, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INAIR>( );
- } else {
- ik[0] = KernelManager->AddKernel<TM, 0, INGROUND, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INGROUND, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INGROUND, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
- if (lays == 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INAIR>( );
- } else {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INGROUND>( );
- }
- break;
-
- case BOTH:
- if (lays == 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INAIR, INAIR>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INAIR, INAIR>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INAIR, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INAIR>( );
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INAIR, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INAIR, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INAIR, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INGROUND>( );
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TM, 0, INGROUND, INAIR>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INGROUND, INAIR>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INGROUND, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INAIR>( );
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INAIR>( );
- } else {
- ik[0] = KernelManager->AddKernel<TM, 0, INGROUND, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TM, 1, INGROUND, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TM, 4, INGROUND, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INGROUND>( );
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INGROUND>( );
- }
- break;
- }
- }
- break;
-
- case (UNGROUNDEDELECTRICDIPOLE):
-
- if (std::abs(Pol[2]) > 0) { // z dipole
-
- switch(FieldsToCalculate) {
-
- case E:
- if (lays == 0 && layr == 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INAIR>( );
- } else {
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
- if (lays == 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INAIR>( );
- } else {
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INGROUND>( );
- }
- break;
-
-
- case BOTH:
- if ( lays == 0 && layr == 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INAIR>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INAIR, INGROUND>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INAIR>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INAIR>( );
- } else {
- ik[11] = KernelManager->AddKernel<TM, 11, INGROUND, INGROUND>( );
- ik[12] = KernelManager->AddKernel<TM, 12, INGROUND, INGROUND>( );
- }
- }
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y grounded HED dipole
-
- switch(FieldsToCalculate) {
-
- case E:
- if ( lays == 0 && layr == 0) {
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INAIR>( );
- } else {
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
- if (lays == 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INAIR>( );
- } else {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INGROUND>( );
- }
- break;
-
- case BOTH:
- if (lays == 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INAIR, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INAIR>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INAIR>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INAIR>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INAIR>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INAIR>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INAIR>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INAIR>( );
- } else {
- ik[5] = KernelManager->AddKernel<TM, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TM, 6, INGROUND, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TE, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TE, 3, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TE, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TE, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TE, 9, INGROUND, INGROUND>( );
- }
- break;
- }
- }
-
-
- break;
-
- case (MAGNETICDIPOLE):
-
- if (std::abs(Pol[2]) > 0) { // z dipole
-
- switch (FieldsToCalculate) {
-
- case E:
-
- if (lays == 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INGROUND, INAIR>( );
- } else {
- ik[12] = KernelManager->AddKernel<TE, 12, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
-
- if (lays == 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TE, 10, INAIR, INAIR>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[10] = KernelManager->AddKernel<TE, 10, INAIR, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[10] = KernelManager->AddKernel<TE, 10, INGROUND, INAIR>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INGROUND, INAIR>( );
- } else {
- ik[10] = KernelManager->AddKernel<TE, 10, INGROUND, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INGROUND, INGROUND>( );
- }
- break;
-
-
- case BOTH:
-
- if (lays == 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INAIR, INAIR>( );
- ik[10] = KernelManager->AddKernel<TE, 10, INAIR, INAIR>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INAIR, INGROUND>( );
- ik[10] = KernelManager->AddKernel<TE, 10, INAIR, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[12] = KernelManager->AddKernel<TE, 12, INGROUND, INAIR>( );
- ik[10] = KernelManager->AddKernel<TE, 10, INGROUND, INAIR>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INGROUND, INAIR>( );
- } else {
- ik[12] = KernelManager->AddKernel<TE, 12, INGROUND, INGROUND>( );
- ik[10] = KernelManager->AddKernel<TE, 10, INGROUND, INGROUND>( );
- ik[11] = KernelManager->AddKernel<TE, 11, INGROUND, INGROUND>( );
- }
- }
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y grounded HED dipole
-
- switch (FieldsToCalculate) {
-
- case E:
- if ( lays == 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TE, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[5] = KernelManager->AddKernel<TE, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TE, 5, INGROUND, INAIR>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INGROUND, INAIR>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INGROUND, INAIR>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INGROUND, INAIR>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INGROUND, INAIR>( );
- } else {
- ik[5] = KernelManager->AddKernel<TE, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INGROUND, INGROUND>( );
- }
- break;
-
- case H:
-
- if ( lays == 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TE, 0, INAIR, INAIR>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INAIR, INAIR>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INAIR, INAIR>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[0] = KernelManager->AddKernel<TE, 0, INAIR, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INAIR, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INAIR, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INAIR, INGROUND>( );
- } else if (lays > 0 && layr == 0) {
- ik[0] = KernelManager->AddKernel<TE, 0, INGROUND, INAIR>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INGROUND, INAIR>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INGROUND, INAIR>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INGROUND, INAIR>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INGROUND, INAIR>( );
- } else {
- ik[0] = KernelManager->AddKernel<TE, 0, INGROUND, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INGROUND, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INGROUND, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INGROUND, INGROUND>( );
- }
- break;
-
- case BOTH:
-
- if ( lays == 0 && layr == 0) {
- ik[5] = KernelManager->AddKernel<TE, 5, INAIR, INAIR>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INAIR, INAIR>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INAIR, INAIR>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INAIR, INAIR>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INAIR, INAIR>( );
- ik[0] = KernelManager->AddKernel<TE, 0, INAIR, INAIR>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INAIR, INAIR>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INAIR, INAIR>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INAIR, INAIR>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INAIR, INAIR>( );
- } else if (lays == 0 && layr > 0) {
- ik[5] = KernelManager->AddKernel<TE, 5, INAIR, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INAIR, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INAIR, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INAIR, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INAIR, INGROUND>( );
- ik[0] = KernelManager->AddKernel<TE, 0, INAIR, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INAIR, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INAIR, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INAIR, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INAIR, INGROUND>( );
- } else {
- ik[5] = KernelManager->AddKernel<TE, 5, INGROUND, INGROUND>( );
- ik[6] = KernelManager->AddKernel<TE, 6, INGROUND, INGROUND>( );
- ik[7] = KernelManager->AddKernel<TM, 7, INGROUND, INGROUND>( );
- ik[8] = KernelManager->AddKernel<TM, 8, INGROUND, INGROUND>( );
- ik[9] = KernelManager->AddKernel<TM, 9, INGROUND, INGROUND>( );
- ik[0] = KernelManager->AddKernel<TE, 0, INGROUND, INGROUND>( );
- ik[1] = KernelManager->AddKernel<TE, 1, INGROUND, INGROUND>( );
- ik[4] = KernelManager->AddKernel<TE, 4, INGROUND, INGROUND>( );
- ik[2] = KernelManager->AddKernel<TM, 2, INGROUND, INGROUND>( );
- ik[3] = KernelManager->AddKernel<TM, 3, INGROUND, INGROUND>( );
- }
- break;
- }
- }
- break;
-
- default:
- std::cerr << "Dipole type incorrect, in dipolesource.cpp";
- exit(EXIT_FAILURE);
-
- }
-
-
- }
-
- void DipoleSource::UpdateFields( const int& ifreq, HankelTransform* Hankel, const Real& wavef) {
-
- Vector3r Pol = Phat;
-
- switch (Type) {
-
- case (GROUNDEDELECTRICDIPOLE):
-
- //Hankel->ComputeRelated(rho, KernelManager);
-
- if (std::abs(Pol[2]) > 0) { // z dipole
- switch(FieldsToCalculate) {
- case E:
- f(10) = Hankel->Zgauss(10, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[10])) / KernelManager->GetRAWKernel(ik[10])->GetYm();
- f(11) = Hankel->Zgauss(11, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11])) / KernelManager->GetRAWKernel(ik[11])->GetYm();
- this->Receivers->AppendEfield(ifreq, irec,
- -Pol[2]*QPI*cp*f(10)*Moment,
- -Pol[2]*QPI*sp*f(10)*Moment,
- Pol[2]*QPI*f(11)*Moment);
- break;
-
- case H:
- f(12) = Hankel->Zgauss(12, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]));
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*QPI*sp*f(12)*Moment,
- Pol[2]*QPI*cp*f(12)*Moment,
- 0. );
- break;
-
- case BOTH:
- f(10) = Hankel->Zgauss(10, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[10])) / KernelManager->GetRAWKernel(ik[10])->GetYm();
- f(11) = Hankel->Zgauss(11, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11])) / KernelManager->GetRAWKernel(ik[11])->GetYm();
- this->Receivers->AppendEfield(ifreq, irec,
- -Pol[2]*QPI*cp*f(10)*Moment,
- -Pol[2]*QPI*sp*f(10)*Moment,
- Pol[2]*QPI*f(11)*Moment );
-
- f(12) = Hankel->Zgauss(12, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]));
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*QPI*sp*f(12)*Moment,
- Pol[2]*QPI*cp*f(12)*Moment,
- 0. );
- } // Fields to calculate Z polarity Electric dipole
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y dipole
- switch(FieldsToCalculate) {
- case E:
- f(2) = Hankel->Zgauss(2, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2])) * KernelManager->GetRAWKernel(ik[2])->GetZs();
- f(3) = Hankel->Zgauss(3, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3])) * KernelManager->GetRAWKernel(ik[3])->GetZs();
- f(0) = Hankel->Zgauss(0, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[0])) / KernelManager->GetRAWKernel(ik[0])->GetYm();
- f(1) = Hankel->Zgauss(1, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[1])) / KernelManager->GetRAWKernel(ik[1])->GetYm();
- f(4) = Hankel->Zgauss(4, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[4])) / KernelManager->GetRAWKernel(ik[4])->GetYm();
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*Moment*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[1]*Moment*QPI*((sps*f(0)+c2p*f(1)/rho)-(cps*f(2)-c2p*f(3)/rho)),
- Pol[1]*Moment*QPI*sp*f(4));
- }
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*((cps*f(0)-c2p*f(1)/rho)-(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
- }
- break;
- case H:
- f(5) = Hankel->Zgauss(5, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]));
- f(6) = Hankel->Zgauss(6, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]));
- f(7) = Hankel->Zgauss(7, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetZs()/KernelManager->GetRAWKernel(ik[7])->GetZm();
- f(8) = Hankel->Zgauss(8, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetZs()/KernelManager->GetRAWKernel(ik[8])->GetZm();
- f(9) = Hankel->Zgauss(9, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetZs()/KernelManager->GetRAWKernel(ik[9])->GetZm();
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*QPI*(sps*f(5)+c2p*f(6)/rho-cps*f(7)+c2p*f(8)/rho)*Moment,
- Pol[1]*QPI*scp*(-f(5)+(Real)(2.)*f(6)/rho-f(7)+(Real)(2.)*f(8)/rho)*Moment,
- -Pol[1]*QPI*cp*f(9)*Moment );
- }
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*(f(5)-(Real)(2.)*f(6)/rho+f(7)-(Real)(2.)*f(8)/rho),
- Pol[0]*Moment*QPI*(-cps*f(5)+c2p*f(6)/rho+sps*f(7)+c2p*f(8)/rho),
- Pol[0]*Moment*QPI*sp*f(9) );
- }
- break;
- case BOTH:
- f(0) = Hankel->Zgauss(0, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[0])) / KernelManager->GetRAWKernel(ik[0])->GetYm();
- f(1) = Hankel->Zgauss(1, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[1])) / KernelManager->GetRAWKernel(ik[1])->GetYm();
- f(4) = Hankel->Zgauss(4, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[4])) / KernelManager->GetRAWKernel(ik[4])->GetYm();
- f(2) = Hankel->Zgauss(2, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2])) * KernelManager->GetRAWKernel(ik[2])->GetZs();
- f(3) = Hankel->Zgauss(3, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3])) * KernelManager->GetRAWKernel(ik[3])->GetZs();
- f(5) = Hankel->Zgauss(5, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]));
- f(6) = Hankel->Zgauss(6, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]));
- f(7) = Hankel->Zgauss(7, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetZs()/KernelManager->GetRAWKernel(ik[7])->GetZm();
- f(8) = Hankel->Zgauss(8, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetZs()/KernelManager->GetRAWKernel(ik[8])->GetZm();
- f(9) = Hankel->Zgauss(9, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetZs()/KernelManager->GetRAWKernel(ik[9])->GetZm();
-
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho))*Moment ,
- Pol[1]*QPI*((sps*f(0)+c2p*f(1)/rho)-(cps*f(2)-c2p*f(3)/rho))*Moment,
- Pol[1]*QPI*sp*f(4)*Moment);
-
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*QPI*(sps*f(5)+c2p*f(6)/rho-cps*f(7)+c2p*f(8)/rho)*Moment,
- Pol[1]*QPI*scp*(-f(5)+(Real)(2.)*f(6)/rho-f(7)+(Real)(2.)*f(8)/rho)*Moment,
- -Pol[1]*QPI*cp*f(9)*Moment );
- }
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*((cps*f(0)-c2p*f(1)/rho)-(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
-
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*(f(5)-(Real)(2.)*f(6)/rho+f(7)-(Real)(2.)*f(8)/rho),
- Pol[0]*Moment*QPI*(-cps*f(5)+c2p*f(6)/rho+sps*f(7)+c2p*f(8)/rho),
- Pol[0]*Moment*QPI*sp*f(9) );
- }
- break;
- }
- }
- break; // GROUNDEDELECTRICDIPOLE
-
-
- case UNGROUNDEDELECTRICDIPOLE:
-
- if (std::abs(Pol[2]) > 0) { // z dipole
- switch(FieldsToCalculate) {
- case E:
- f(10) = 0;
- f(11) = Hankel->Zgauss(11, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11])) / KernelManager->GetRAWKernel(ik[11])->GetYm();
-
- this->Receivers->AppendEfield(ifreq, irec,
- -Pol[2]*QPI*cp*f(10)*Moment,
- -Pol[2]*QPI*sp*f(10)*Moment,
- Pol[2]*QPI*f(11)*Moment);
- break;
-
- case H:
- f(12) = Hankel->Zgauss(12, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]));
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*QPI*sp*f(12)*Moment,
- Pol[2]*QPI*cp*f(12)*Moment,
- 0. );
- break;
-
- case BOTH:
- f(10) = 0;
- f(11) = Hankel->Zgauss(11, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11])) / KernelManager->GetRAWKernel(ik[11])->GetYm();
- this->Receivers->AppendEfield(ifreq, irec,
- -Pol[2]*QPI*cp*f(10)*Moment,
- -Pol[2]*QPI*sp*f(10)*Moment,
- Pol[2]*QPI*f(11)*Moment );
-
- f(12) = Hankel->Zgauss(12, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]));
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*QPI*sp*f(12)*Moment,
- Pol[2]*QPI*cp*f(12)*Moment,
- 0. );
- } // Fields to calculate Z polarity Electric dipole
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y dipole
-
- switch(FieldsToCalculate) {
- case E:
- f(0) = 0;
- f(1) = 0;
- f(2) = Hankel->Zgauss(2, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2])) * KernelManager->GetRAWKernel(ik[2])->GetZs();
- f(3) = Hankel->Zgauss(3, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3])) * KernelManager->GetRAWKernel(ik[3])->GetZs();
- f(4) = 0;
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho))*Moment,
- Pol[1]*QPI*((sps*f(0)+c2p*f(1)/rho)-(cps*f(2)-c2p*f(3)/rho))*Moment,
- Pol[1]*QPI*sp*f(4)*Moment);
- }
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*((cps*f(0)-c2p*f(1)/rho)-(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
- }
- break;
- case H:
- // TI - Comparisons with Amira show slight better agreement when neglecting these grounding terms
- f(5) = 0; //Hankel->Zgauss(5, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]));
- f(6) = 0; //Hankel->Zgauss(6, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]));
- f(7) = Hankel->Zgauss(7, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetZs()/KernelManager->GetRAWKernel(ik[7])->GetZm();
- f(8) = Hankel->Zgauss(8, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetZs()/KernelManager->GetRAWKernel(ik[8])->GetZm();
- f(9) = Hankel->Zgauss(9, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetZs()/KernelManager->GetRAWKernel(ik[9])->GetZm();
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*QPI*(sps*f(5)+c2p*f(6)/rho-cps*f(7)+c2p*f(8)/rho)*Moment,
- Pol[1]*QPI*scp*(-f(5)+(Real)(2.)*f(6)/rho-f(7)+(Real)(2.)*f(8)/rho)*Moment,
- -Pol[1]*QPI*cp*f(9)*Moment );
- }
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*(f(5)-(Real)(2.)*f(6)/rho+f(7)-(Real)(2.)*f(8)/rho),
- Pol[0]*Moment*QPI*(-cps*f(5)+c2p*f(6)/rho+sps*f(7)+c2p*f(8)/rho),
- Pol[0]*Moment*QPI*sp*f(9) );
- }
- break;
-
- case BOTH:
- f(0) = 0;
- f(1) = 0;
- f(4) = 0;
- f(2) = Hankel->Zgauss(2, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2])) * KernelManager->GetRAWKernel(0)->GetZs();
- f(3) = Hankel->Zgauss(3, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3])) * KernelManager->GetRAWKernel(1)->GetZs();
- f(5) = 0;//Hankel->Zgauss(5, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]));
- f(6) = 0;//Hankel->Zgauss(6, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]));
- f(7) = Hankel->Zgauss(7, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetZs()/KernelManager->GetRAWKernel(ik[7])->GetZm();
- f(8) = Hankel->Zgauss(8, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetZs()/KernelManager->GetRAWKernel(ik[8])->GetZm();
- f(9) = Hankel->Zgauss(9, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetZs()/KernelManager->GetRAWKernel(ik[9])->GetZm();
-
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho))*Moment ,
- Pol[1]*QPI*((sps*f(0)+c2p*f(1)/rho)-(cps*f(2)-c2p*f(3)/rho))*Moment,
- Pol[1]*QPI*sp*f(4)*Moment);
-
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*QPI*(sps*f(5)+c2p*f(6)/rho-cps*f(7)+c2p*f(8)/rho)*Moment,
- Pol[1]*QPI*scp*(-f(5)+(Real)(2.)*f(6)/rho-f(7)+(Real)(2.)*f(8)/rho)*Moment,
- -Pol[1]*QPI*cp*f(9)*Moment );
- }
-
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*((cps*f(0)-c2p*f(1)/rho)-(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*((f(0)-(Real)(2.)*f(1)/rho)+(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
-
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*(f(5)-(Real)(2.)*f(6)/rho+f(7)-(Real)(2.)*f(8)/rho),
- Pol[0]*Moment*QPI*(-cps*f(5)+c2p*f(6)/rho+sps*f(7)+c2p*f(8)/rho),
- Pol[0]*Moment*QPI*sp*f(9) );
- }
- break;
- }
- }
-
- break; // UNGROUNDEDELECTRICDIPOLE
-
- case MAGNETICDIPOLE:
-
- //Hankel->ComputeRelated(rho, KernelManager);
- if (std::abs(Pol[2]) > 0) { // z dipole
- switch(FieldsToCalculate) {
- case E:
- f(12)=Hankel->Zgauss(12, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]))*KernelManager->GetRAWKernel(ik[12])->GetZs();
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[2]*Moment*QPI*sp*f(12),
- -Pol[2]*Moment*QPI*cp*f(12),
- 0);
- break;
- case H:
- f(10)=Hankel->Zgauss(10, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[10]))*KernelManager->GetRAWKernel(ik[10])->GetZs()/KernelManager->GetRAWKernel(ik[10])->GetZm();
- f(11)=Hankel->Zgauss(11, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11]))*KernelManager->GetRAWKernel(ik[11])->GetZs()/KernelManager->GetRAWKernel(ik[11])->GetZm();
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*Moment*QPI*cp*f(10),
- -Pol[2]*Moment*QPI*sp*f(10),
- Pol[2]*Moment*QPI*f(11) );
- break;
-
- case BOTH:
- f(12)=Hankel->Zgauss(12, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[12]))*KernelManager->GetRAWKernel(ik[12])->GetZs();
- f(10)=Hankel->Zgauss(10, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[10]))*KernelManager->GetRAWKernel(ik[10])->GetZs()/KernelManager->GetRAWKernel(ik[10])->GetZm();
- f(11)=Hankel->Zgauss(11, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[11]))*KernelManager->GetRAWKernel(ik[11])->GetZs()/KernelManager->GetRAWKernel(ik[11])->GetZm();
-
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[2]*Moment*QPI*sp*f(12),
- -Pol[2]*Moment*QPI*cp*f(12),
- 0);
-
- this->Receivers->AppendHfield(ifreq, irec,
- -Pol[2]*Moment*QPI*cp*f(10),
- -Pol[2]*Moment*QPI*sp*f(10),
- Pol[2]*Moment*QPI*f(11) );
- break;
- }
- }
- if (std::abs(Pol[1]) > 0 || std::abs(Pol[0]) > 0) { // x or y grounded HED dipole
-
- switch (FieldsToCalculate) {
-
- case E:
-
- f(5) = Hankel->Zgauss(5, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]))*KernelManager->GetRAWKernel(ik[5])->GetZs();
- f(6) = Hankel->Zgauss(6, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]))*KernelManager->GetRAWKernel(ik[6])->GetZs();
- f(7) = Hankel->Zgauss(7, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetKs()/KernelManager->GetRAWKernel(ik[7])->GetYm();
- f(8) = Hankel->Zgauss(8, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetKs()/KernelManager->GetRAWKernel(ik[8])->GetYm();
- f(9) = Hankel->Zgauss(9, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetKs()/KernelManager->GetRAWKernel(ik[9])->GetYm();
-
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*((-f(5)+(Real)(2.)*f(6)/rho)+(f(7)-(Real)(2.)*f(8)/rho)),
- Pol[0]*Moment*QPI*((cps*f(5)-c2p*f(6)/rho)+(sps*f(7)+c2p*f(8)/rho)),
- Pol[0]*Moment*QPI*sp*f(9));
- }
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*Moment*QPI*(-(sps*f(5)+c2p*f(6)/rho)-(cps*f(7)-c2p*f(8)/rho)),
- Pol[1]*Moment*QPI*scp*((f(5)-(Real)(2.)*f(6)/rho)-(f(7)-(Real)(2.)*f(8)/rho)),
- -Pol[1]*Moment*QPI*cp*f(9) );
- }
- break;
-
- case H:
- f(0) = Hankel->Zgauss(0, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[0]))*KernelManager->GetRAWKernel(ik[0])->GetZs()/KernelManager->GetRAWKernel(ik[0])->GetZm();
- f(1) = Hankel->Zgauss(1, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[1]))*KernelManager->GetRAWKernel(ik[1])->GetZs()/KernelManager->GetRAWKernel(ik[1])->GetZm();
- f(4) = Hankel->Zgauss(4, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[4]))*KernelManager->GetRAWKernel(ik[4])->GetZs()/KernelManager->GetRAWKernel(ik[4])->GetZm();
- f(2) = Hankel->Zgauss(2, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2]))*KernelManager->GetRAWKernel(ik[2])->GetKs();
- f(3) = Hankel->Zgauss(3, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3]))*KernelManager->GetRAWKernel(ik[3])->GetKs();
-
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*(cps*f(0)-c2p*f(1)/rho+(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*(f(0)-(Real)(2.)*f(1)/rho-(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
- }
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*Moment*QPI*scp*(f(0)-(Real)(2.)*f(1)/rho-(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[1]*Moment*QPI*(sps*f(0)+c2p*f(1)/rho+(cps*f(2)-c2p*f(3)/rho)),
- Pol[1]*Moment*QPI*sp*f(4));
- }
- break;
-
- case BOTH:
- f(5) = Hankel->Zgauss(5, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[5]))*KernelManager->GetRAWKernel(ik[5])->GetZs();
- f(6) = Hankel->Zgauss(6, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[6]))*KernelManager->GetRAWKernel(ik[6])->GetZs();
- f(7) = Hankel->Zgauss(7, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[7]))*KernelManager->GetRAWKernel(ik[7])->GetKs()/KernelManager->GetRAWKernel(ik[7])->GetYm();
- f(8) = Hankel->Zgauss(8, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[8]))*KernelManager->GetRAWKernel(ik[8])->GetKs()/KernelManager->GetRAWKernel(ik[8])->GetYm();
- f(9) = Hankel->Zgauss(9, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[9]))*KernelManager->GetRAWKernel(ik[9])->GetKs()/KernelManager->GetRAWKernel(ik[9])->GetYm();
- f(0) = Hankel->Zgauss(0, TE, 0, rho, wavef, KernelManager->GetRAWKernel(ik[0]))*KernelManager->GetRAWKernel(ik[0])->GetZs()/KernelManager->GetRAWKernel(ik[0])->GetZm();
- f(1) = Hankel->Zgauss(1, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[1]))*KernelManager->GetRAWKernel(ik[1])->GetZs()/KernelManager->GetRAWKernel(ik[1])->GetZm();
- f(4) = Hankel->Zgauss(4, TE, 1, rho, wavef, KernelManager->GetRAWKernel(ik[4]))*KernelManager->GetRAWKernel(ik[4])->GetZs()/KernelManager->GetRAWKernel(ik[4])->GetZm();
- f(2) = Hankel->Zgauss(2, TM, 0, rho, wavef, KernelManager->GetRAWKernel(ik[2]))*KernelManager->GetRAWKernel(ik[2])->GetKs();
- f(3) = Hankel->Zgauss(3, TM, 1, rho, wavef, KernelManager->GetRAWKernel(ik[3]))*KernelManager->GetRAWKernel(ik[3])->GetKs();
-
- if (std::abs(Pol[0]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[0]*Moment*QPI*scp*((-f(5)+(Real)(2.)*f(6)/rho)+(f(7)-(Real)(2.)*f(8)/rho)),
- Pol[0]*Moment*QPI*((cps*f(5)-c2p*f(6)/rho)+(sps*f(7)+c2p*f(8)/rho)),
- Pol[0]*Moment*QPI*sp*f(9));
-
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[0]*Moment*QPI*(cps*f(0)-c2p*f(1)/rho+(sps*f(2)+c2p*f(3)/rho)),
- Pol[0]*Moment*QPI*scp*(f(0)-(Real)(2.)*f(1)/rho-(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[0]*Moment*QPI*cp*f(4) );
- }
- if (std::abs(Pol[1]) > 0) {
- this->Receivers->AppendEfield(ifreq, irec,
- Pol[1]*Moment*QPI*(-(sps*f(5)+c2p*f(6)/rho)-(cps*f(7)-c2p*f(8)/rho)),
- Pol[1]*Moment*QPI*scp*((f(5)-(Real)(2.)*f(6)/rho)-(f(7)-(Real)(2.)*f(8)/rho)),
- -Pol[1]*Moment*QPI*cp*f(9) );
- this->Receivers->AppendHfield(ifreq, irec,
- Pol[1]*Moment*QPI*scp*(f(0)-(Real)(2.)*f(1)/rho-(f(2)-(Real)(2.)*f(3)/rho)),
- Pol[1]*Moment*QPI*(sps*f(0)+c2p*f(1)/rho+(cps*f(2)-c2p*f(3)/rho)),
- Pol[1]*Moment*QPI*sp*f(4));
- }
-
- break;
- }
- }
- break;
- case NOSOURCETYPE:
- throw NonValidDipoleType(this);
-
- } // Source Type Switch
- }
-
- // ==================== INQUIRY ======================
-
- std::shared_ptr<KernelEM1DManager> DipoleSource::GetKernelManager() {
- return KernelManager;
- }
-
- Vector3r DipoleSource::GetLocation() {
- return this->Location;
- }
-
- #ifdef LEMMAUSEVTK
- vtkActor* DipoleSource::GetVtkActor() {
-
- vtkActor* vActor;
-
- vtkLineSource* vLineSource;
- vtkTubeFilter* vTube;
- vtkPolyDataMapper* vMapper;
- vtkRegularPolygonSource* vCircleSource;
-
- vLineSource = vtkLineSource::New();
- vTube = vtkTubeFilter::New();
- vMapper = vtkPolyDataMapper::New();
- vCircleSource = vtkRegularPolygonSource::New();
-
- VectorXr M0 = Location - .5*Moment*Phat;
- VectorXr M1 = Location + .5*Moment*Phat;
-
- vActor = vtkActor::New();
-
- switch (Type) {
-
- case GROUNDEDELECTRICDIPOLE:
-
- vLineSource->SetPoint1( M0(0), M0(1), M0(2));
- vLineSource->SetPoint2( M1(0), M1(1), M1(2));
-
- vTube->SetInputConnection(vLineSource->GetOutputPort());
- vTube->SetRadius(.1 * std::abs(Moment));
- vTube->SetNumberOfSides(6);
- vTube->SetCapping(1);
- vMapper->SetInputConnection(vTube->GetOutputPort());
- vActor->SetMapper(vMapper);
- vActor->GetProperty()->SetColor(Phat[0], Phat[1], Phat[2]);
- break;
-
- case UNGROUNDEDELECTRICDIPOLE:
-
- vLineSource->SetPoint1( M0(0), M0(1), M0(2));
- vLineSource->SetPoint2( M1(0), M1(1), M1(2));
- vTube->SetInputConnection(vLineSource->GetOutputPort());
- vTube->SetRadius(.1 * std::abs(Moment));
- vTube->SetNumberOfSides(6);
- vTube->SetCapping(1);
- vMapper->SetInputConnection(vTube->GetOutputPort());
- vActor->SetMapper(vMapper);
- //vActor->GetProperty()->SetColor(Phat[0], Phat[1], Phat[2]);
- vActor->GetProperty()->SetColor(rand()/(Real)(RAND_MAX), rand()/(Real)(RAND_MAX), rand()/(Real)(RAND_MAX));
- vActor->GetProperty()->SetOpacity(1.);
- break;
-
- case MAGNETICDIPOLE:
-
- vCircleSource->SetCenter(Location(0), Location(1),
- Location(2));
- vCircleSource->SetNumberOfSides(360);
-
- vCircleSource->SetNormal(Phat[0], Phat[1], Phat[2]);
- vCircleSource->SetRadius(0.2); // .2 m radius
- vCircleSource->SetGeneratePolygon(false);
- vCircleSource->SetGeneratePolyline(true);
- vCircleSource->Update();
-
- vTube->SetInputConnection(vCircleSource->GetOutputPort());
- //vTube->SetRadius( max((float)(*xCoords->GetTuple(nx)),
- // (float)(*yCoords->GetTuple(ny))) / 100);
- vTube->SetRadius(.1*std::abs(Moment));
- vTube->SetNumberOfSides(6);
- vTube->SetCapping(1);
- vMapper->SetInputConnection(vTube->GetOutputPort());
- vActor->SetMapper(vMapper);
- vActor->GetProperty()->SetColor(.9,.2,.9);
- break;
-
- default:
- throw NonValidDipoleType();
- }
-
- vLineSource->Delete();
- vCircleSource->Delete();
- vTube->Delete();
- vMapper->Delete();
-
- return vActor;
-
- }
- #endif
-
- Real DipoleSource::GetLocation(const int& coordinate) {
- switch (coordinate) {
- case (0):
- return this->Location.x();
- //break; // implicit
- case (1):
- return this->Location.y();
- //break; // implicit
- case (2):
- return this->Location.z();
- //break; // implicit
- default:
- throw NonValidLocationCoordinate( );
- }
- }
-
- DIPOLESOURCETYPE DipoleSource::GetDipoleSourceType() {
- return this->Type;
- }
-
- //DipoleSourcePolarisation DipoleSource::GetDipoleSourcePolarisation() {
- // return this->Polarisation;
- //}
-
- Real DipoleSource::GetAngularFrequency(const int& ifreq) {
- return 2.*PI*this->Freqs(ifreq);
- }
-
- Real DipoleSource::GetFrequency(const int& ifreq) {
- return this->Freqs(ifreq);
- }
-
- VectorXr DipoleSource::GetFrequencies( ) {
- return this->Freqs;
- }
-
- Real DipoleSource::GetPhase() {
- return this->Phase;
- }
-
- Real DipoleSource::GetMoment() {
- return this->Moment;
- }
-
- int DipoleSource::GetNumberOfFrequencies() {
- return (int)(this->Freqs.size());
- }
-
- void DipoleSource::SetNumberOfFrequencies(const int &nfreq){
- Freqs.resize(nfreq);
- Freqs.setZero();
- }
-
- void DipoleSource::SetFrequency(const int &ifreq, const Real &freq){
- Freqs(ifreq) = freq;
- }
-
- void DipoleSource::SetFrequencies(const VectorXr &freqs){
- Freqs = freqs;
- }
-
- /////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- // Error classes
- NullDipoleSource::NullDipoleSource() :
- runtime_error( "NULL VALUED DIPOLE SOURCE") {}
-
- NonValidDipoleTypeAssignment::NonValidDipoleTypeAssignment( ) :
- runtime_error( "NON VALID DIPOLE TYPE ASSIGNMENT") { }
-
- NonValidDipoleType::NonValidDipoleType( LemmaObject* ptr ) :
- runtime_error( "NON VALID DIPOLE TYPE") {
- std::cout << "Thrown by instance of "
- << ptr->GetName() << std::endl;
- }
-
- NonValidDipoleType::NonValidDipoleType( ) :
- runtime_error( "NON VALID DIPOLE TYPE") { }
-
- NonValidDipolePolarity::NonValidDipolePolarity () :
- runtime_error( "NON VALID DIPOLE POLARITY") { }
-
- NonValidDipolePolarisation::NonValidDipolePolarisation( ) :
- runtime_error( "NON VALID DIPOLE TYPE") { }
-
- NonValidDipolePolarisationAssignment::
- NonValidDipolePolarisationAssignment( ) :
- runtime_error( "NON VALID DIPOLE POLARISATION ASSIGNMENT") { }
-
- NonValidLocationCoordinate::NonValidLocationCoordinate( ) :
- runtime_error( "NON VALID LOCATION COORDINATE REQUESTED") { }
-
- }
|