123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
-
-
-
-
-
-
- #include <iostream>
- #include <fstream>
- #include "dipolesource.h"
- #include "layeredearthem.h"
- #include "receiverpoints.h"
- #include "emearth1d.h"
-
- #ifdef LEMMAUSEOMP
- #include "omp.h"
- #endif
-
-
-
-
-
- #ifdef LEMMAUSEVTK
- #include "vtkRenderer.h"
- #include "vtkRenderWindow.h"
- #include "vtkRenderWindowInteractor.h"
- #include "vtkDoubleArray.h"
- #include "vtkXYPlotActor.h"
- #include "vtkXYPlotWidget.h"
- #include "vtkProperty2D.h"
- #endif
-
- #include "timer.h"
-
- using namespace Lemma;
-
- int main() {
-
-
- jsw_timer timer;
-
- DipoleSource *dipole = DipoleSource::New();
- dipole->SetType(MAGNETICDIPOLE);
- dipole->SetPolarisation(0., 0.0, 1.0);
-
-
-
-
-
-
- dipole->SetLocation(0., 0., -0.001);
-
- int iif=10000;
- dipole->SetNumberOfFrequencies(iif);
- Real w0 = 10;
- for (int iw=0; iw<iif; ++iw) {
- dipole->SetFrequency(iw, w0);
- w0 += 1523.;
- }
-
- VectorXcr sigma(8);
- sigma << 0., 3e-4, 5e-4, 1e-2, .5, 5e-6, .03, .04;
- VectorXr thick(6);
- thick << 10 , 10 , 10 , 10 , 10 , 10;
-
- LayeredEarthEM *earth = LayeredEarthEM::New();
- earth->SetNumberOfLayers(8);
- earth->SetLayerConductivity(sigma);
- earth->SetLayerThickness(thick);
-
- ReceiverPoints *receivers = ReceiverPoints::New();
- Vector3r loc;
- receivers->SetNumberOfReceivers(1);
- loc << 150, 175, -.01;
- receivers->SetLocation(0, loc);
-
-
- EMEarth1D *EmEarth = EMEarth1D::New();
- EmEarth->AttachDipoleSource(dipole);
- EmEarth->AttachLayeredEarthEM(earth);
- EmEarth->AttachReceiverPoints(receivers);
-
- EmEarth->SetFieldsToCalculate(H);
-
-
-
-
- EmEarth->SetHankelTransformMethod(QWEKEY);
-
- timer.begin();
- EmEarth->MakeCalc3();
-
-
- Real lemmaTime = timer.end();
-
- std::cout << lemmaTime << "\t";
-
- #ifdef LEMMAUSEVTK
- vtkDataObject *_dataObjectxr = receivers->GetVtkDataObjectFreq(HFIELDREAL, 0,
- 0, iif, XCOMPONENT, dipole->GetFrequencies());
-
- vtkDataObject *_dataObjectxi = receivers->GetVtkDataObjectFreq(HFIELDIMAG, 0,
- 0, iif, XCOMPONENT, dipole->GetFrequencies());
-
- vtkDataObject *_dataObjectyr= receivers->GetVtkDataObjectFreq(HFIELDREAL, 0,
- 0, iif, YCOMPONENT, dipole->GetFrequencies());
-
- vtkDataObject *_dataObjectyi = receivers->GetVtkDataObjectFreq(HFIELDIMAG, 0,
- 0, iif, YCOMPONENT, dipole->GetFrequencies());
-
- vtkDataObject *_dataObjectzr = receivers->GetVtkDataObjectFreq(HFIELDREAL, 0,
- 0, iif, ZCOMPONENT, dipole->GetFrequencies());
-
- vtkDataObject *_dataObjectzi = receivers->GetVtkDataObjectFreq(HFIELDIMAG, 0,
- 0, iif, ZCOMPONENT, dipole->GetFrequencies());
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef LEMMAUSEVTK
- vtkRenderer *_ren = vtkRenderer::New();
- vtkRenderWindow *_renwin = vtkRenderWindow::New();
- _renwin->AddRenderer(_ren);
-
-
-
- vtkXYPlotActor *_xplot = vtkXYPlotActor::New();
-
-
- _xplot->AddDataObjectInput( _dataObjectxr);
- _xplot->AddDataObjectInput( _dataObjectxi);
-
-
- _xplot->SetTitle("X field");
- _xplot->SetXTitle("Depth");
- _xplot->SetYTitle("E Field");
- _xplot->SetXValuesToValue();
-
-
-
- _xplot->SetDataObjectXComponent(0,1);
- _xplot->SetDataObjectYComponent(0,0);
- _xplot->SetDataObjectXComponent(1,1);
- _xplot->SetDataObjectYComponent(1,0);
- _xplot->SetDataObjectXComponent(2,1);
- _xplot->SetDataObjectYComponent(2,0);
- _xplot->SetDataObjectXComponent(3,1);
- _xplot->SetDataObjectYComponent(3,0);
- _xplot->SetNumberOfXLabels(3);
- _xplot->SetPlotColor(0,1,1,1);
- _xplot->SetPlotColor(1,1,1,1);
- _xplot->SetPlotColor(2,1,0,0);
- _xplot->SetPlotColor(3,1,0,0);
- _xplot->GetProperty()->SetLineWidth(2);
- _xplot->GetProperty()->SetPointSize(4);
-
-
-
-
-
-
-
-
-
-
-
- _xplot->PlotCurvePointsOff();
- _xplot->PlotCurveLinesOff();
- _xplot->GetPositionCoordinate()->SetValue(0.0, 0.67, 0);
- _xplot->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0);
-
-
-
-
- vtkXYPlotActor *_yplot = vtkXYPlotActor::New();
-
-
- _yplot->AddDataObjectInput( _dataObjectyr);
- _yplot->AddDataObjectInput( _dataObjectyi);
-
-
- _yplot->SetTitle("Y field");
- _yplot->SetXTitle("Depth");
- _yplot->SetYTitle("E Field");
- _yplot->SetXValuesToValue();
-
-
-
- _yplot->SetDataObjectXComponent(0,1);
- _yplot->SetDataObjectYComponent(0,0);
- _yplot->SetDataObjectXComponent(1,1);
- _yplot->SetDataObjectYComponent(1,0);
- _yplot->SetDataObjectXComponent(2,1);
- _yplot->SetDataObjectYComponent(2,0);
- _yplot->SetDataObjectXComponent(3,1);
- _yplot->SetDataObjectYComponent(3,0);
- _yplot->SetNumberOfXLabels(3);
- _yplot->SetPlotColor(0,1,1,1);
- _yplot->SetPlotColor(1,1,1,1);
- _yplot->SetPlotColor(2,1,0,0);
- _yplot->SetPlotColor(3,1,0,0);
- _yplot->GetProperty()->SetLineWidth(2);
- _yplot->GetProperty()->SetPointSize(4);
- _yplot->GetPositionCoordinate()->SetValue(0.00, 0.33, 0);
- _yplot->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0);
-
-
-
-
-
-
-
-
-
-
-
- _yplot->PlotCurvePointsOff();
- _yplot->PlotCurveLinesOff();
-
-
-
-
- vtkXYPlotActor *_zplot = vtkXYPlotActor::New();
-
-
- _zplot->AddDataObjectInput( _dataObjectzr);
- _zplot->AddDataObjectInput( _dataObjectzi);
-
-
- _zplot->SetTitle("Z field");
- _zplot->SetXTitle("Depth");
- _zplot->SetYTitle("E Field");
- _zplot->SetXValuesToValue();
-
-
-
- _zplot->SetDataObjectXComponent(0,1);
- _zplot->SetDataObjectYComponent(0,0);
- _zplot->SetDataObjectXComponent(1,1);
- _zplot->SetDataObjectYComponent(1,0);
- _zplot->SetDataObjectXComponent(2,1);
- _zplot->SetDataObjectYComponent(2,0);
- _zplot->SetDataObjectXComponent(3,1);
- _zplot->SetDataObjectYComponent(3,0);
- _zplot->SetNumberOfXLabels(3);
- _zplot->SetPlotColor(0,1,1,1);
- _zplot->SetPlotColor(1,1,1,1);
- _zplot->SetPlotColor(2,1,0,0);
- _zplot->SetPlotColor(3,1,0,0);
- _zplot->GetProperty()->SetLineWidth(2);
- _zplot->GetProperty()->SetPointSize(4);
- _zplot->GetPositionCoordinate()->SetValue(0.0, 0.0, 0);
- _zplot->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0);
-
-
-
-
-
-
-
-
-
-
- _zplot->PlotCurvePointsOff();
- _zplot->PlotCurveLinesOff();
-
-
- _ren->AddActor2D(_xplot);
- _ren->AddActor2D(_yplot);
- _ren->AddActor2D(_zplot);
-
- vtkRenderWindowInteractor *_iren = vtkRenderWindowInteractor::New();
- _iren->SetRenderWindow(_renwin);
- _iren->Initialize();
- _renwin->Render();
-
-
-
-
-
- _iren->Start();
-
-
-
-
-
-
-
-
-
-
-
- #endif
-
- EmEarth->Delete();
- receivers->Delete();
- earth->Delete();
- dipole->Delete();
-
- return 0;
-
-
- }
|