828 FieldDataEfficient(EffectiveIndex2D* solver, std::size_t num,
const shared_ptr<
const RectangularMesh<2>>& rect_mesh)
830 rect_mesh(rect_mesh),
831 valx(rect_mesh->tran()->
size()),
832 valy(rect_mesh->vert()->
size()) {
835#pragma omp for nowait
837 double x = rect_mesh->tran()->at(idx);
839 if (x < 0. && this->solver->modes[num].symmetry != EffectiveIndex2D::SYMMETRY_NONE) {
841 if (this->solver->modes[num].symmetry == EffectiveIndex2D::SYMMETRY_NEGATIVE) negate =
true;
843 size_t ix = this->solver->mesh->tran()->findIndex(x);
844 if (ix >= this->solver->xend) ix = this->solver->xend - 1;
845 if (ix < this->solver->xbegin) ix = this->solver->xbegin;
847 x -= this->solver->mesh->tran()->at(ix - 1);
848 else if (this->solver->modes[num].symmetry == EffectiveIndex2D::SYMMETRY_NONE)
849 x -= this->solver->mesh->tran()->at(0);
850 dcomplex phasx = exp(-I * this->
kx[ix] * x);
852 this->solver->modes[this->num].xfields[ix].F * phasx + this->solver->modes[num].xfields[ix].B / phasx;
853 if (negate) val = -val;
859 double y = rect_mesh->vert()->at(idy);
860 size_t iy = this->solver->mesh->vert()->findIndex(y);
861 if (iy >= this->solver->yend) iy = this->solver->yend - 1;
862 if (iy < this->solver->ybegin) iy = this->solver->ybegin;
863 y -= solver->mesh->vert()->at(
max(
int(iy) - 1, 0));
864 dcomplex phasy = exp(-I * this->
ky[iy] * y);
865 valy[idy] = this->solver->yfields[iy].F * phasy + this->solver->yfields[iy].B / phasy;
879 DataVector<const FieldT>
getAll()
const override {
880 DataVector<FieldT> results(rect_mesh->size());
881 if (rect_mesh->getIterationOrder() == RectangularMesh<2>::ORDER_10) {
884 FieldT* data = results.data() + i1 * rect_mesh->axis[0]->size();
885 for (
size_t i0 = 0; i0 < rect_mesh->axis[0]->size(); ++i0) {
886 dcomplex f = valx[i0] * valy[i1];
887 data[i0] = this->
value(f);
893 FieldT* data = results.data() + i0 * rect_mesh->axis[1]->size();
894 for (
size_t i1 = 0; i1 < rect_mesh->axis[1]->size(); ++i1) {
895 dcomplex f = valx[i0] * valy[i1];
896 data[i1] = this->
value(f);