38#include <boost/core/ignore_unused.hpp> 
   39#include <boost/math/special_functions/fpclassify.hpp> 
   57        "Write data as equi-spaced output using simplices to represent the " 
   58        "data for connecting points");
 
   64        ConfigOption(
true, 
"0", 
"Only process tetrahedral elements");
 
   78    int nel = 
m_f->m_exp[0]->GetExpSize();
 
   82        int nfields = 
m_f->m_variables.size();
 
   86        for (
int i = 0; i < nfields + coordim; ++i)
 
   90        vector<Array<OneD, int>> ptsConn;
 
   94                coordim, 
m_f->m_variables, pts);
 
   96        m_f->m_fieldPts->SetConnectivity(ptsConn);
 
  100    int coordim  = 
m_f->m_exp[0]->GetCoordim(0);
 
  101    int shapedim = 
m_f->m_exp[0]->GetExp(0)->GetShapeDimension();
 
  102    int npts     = 
m_f->m_exp[0]->GetTotPoints();
 
  106    bool homogeneous1D = 
false;
 
  107    if (
m_f->m_numHomogeneousDir == 1)
 
  111        homogeneous1D = 
true;
 
  113    else if (
m_f->m_numHomogeneousDir == 2)
 
  115        ASSERTL0(
false, 
"Homegeneous2D case not supported");
 
  120    int newtotpoints = 0;
 
  128    map<int, StdRegions::Orientation> face0orient;
 
  129    set<int> prismorient;
 
  134    vector<Array<OneD, int>> ptsConn;
 
  137    for (
int i = 0; i < nel; ++i)
 
  139        e = 
m_f->m_exp[0]->GetExp(i);
 
  143            int fid                         = e->GetGeom()->GetFid(0);
 
  144            if (face0orient.count(fid))
 
  146                prismorient.insert(i);
 
  166    for (
int i = 0; i < nel; ++i)
 
  168        e = 
m_f->m_exp[0]->GetExp(i);
 
  171            int fid = e->GetGeom()->GetFid(2);
 
  173            if (face0orient.count(fid))
 
  188                        prismorient.insert(i);
 
  195                        prismorient.insert(i);
 
  202    for (
int i = 0; i < nel; ++i)
 
  204        e = 
m_f->m_exp[0]->GetExp(i);
 
  207            if (
m_f->m_exp[0]->GetExp(i)->DetShapeType() !=
 
  214        switch (e->DetShapeType())
 
  218                int npoints0 = e->GetBasis(0)->GetNumPoints();
 
  226                int np0 = e->GetBasis(0)->GetNumPoints();
 
  227                int np1 = e->GetBasis(1)->GetNumPoints();
 
  228                int np  = max(np0, np1);
 
  235                int np0 = e->GetBasis(0)->GetNumPoints();
 
  236                int np1 = e->GetBasis(1)->GetNumPoints();
 
  237                int np  = max(np0, np1);
 
  245                int np0 = e->GetBasis(0)->GetNumPoints();
 
  246                int np1 = e->GetBasis(1)->GetNumPoints();
 
  247                int np2 = e->GetBasis(2)->GetNumPoints();
 
  248                int np  = max(np0, max(np1, np2));
 
  256                int np0 = e->GetBasis(0)->GetNumPoints();
 
  257                int np1 = e->GetBasis(1)->GetNumPoints();
 
  258                int np2 = e->GetBasis(2)->GetNumPoints();
 
  259                int np  = max(np0, max(np1, np2));
 
  267                int np0 = e->GetBasis(0)->GetNumPoints();
 
  268                int np1 = e->GetBasis(1)->GetNumPoints();
 
  269                int np2 = e->GetBasis(2)->GetNumPoints();
 
  270                int np  = max(np0, max(np1, np2));
 
  278                int np0 = e->GetBasis(0)->GetNumPoints();
 
  279                int np1 = e->GetBasis(1)->GetNumPoints();
 
  280                int np2 = e->GetBasis(2)->GetNumPoints();
 
  281                int np  = max(np0, max(np1, np2));
 
  289                ASSERTL0(
false, 
"Points not known");
 
  293        ppe.push_back(newpoints);
 
  294        newtotpoints += newpoints;
 
  298            bool standard = 
true;
 
  300            if (prismorient.count(i))
 
  305            e->GetSimplexEquiSpacedConnectivity(conn, standard);
 
  310            if ((prevNcoeffs != e->GetNcoeffs()) ||
 
  311                (prevNpoints != e->GetTotPoints()))
 
  313                prevNcoeffs = e->GetNcoeffs();
 
  314                prevNpoints = e->GetTotPoints();
 
  316                e->GetSimplexEquiSpacedConnectivity(conn);
 
  320        for (
int j = 0; j < conn.size(); ++j)
 
  322            newconn[j] = conn[j] + cnt;
 
  325        ptsConn.push_back(newconn);
 
  329    nfields = 
m_f->m_variables.size();
 
  333    for (
int i = 0; i < nfields + coordim; ++i)
 
  339    for (
int i = 0; i < coordim; ++i)
 
  344    for (
int i = coordim; i < 3; ++i)
 
  349    m_f->m_exp[0]->GetCoords(coords[0], coords[1], coords[2]);
 
  353    for (
int n = 0; n < coordim; ++n)
 
  357        for (
int i = 0; i < nel; ++i)
 
  359            m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
 
  360                coords[n] + cnt, tmp = pts[n] + cnt1);
 
  362            cnt += 
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
 
  366    for (
int n = 0; n < 
m_f->m_variables.size(); ++n)
 
  371        if (
m_config[
"modalenergy"].m_beenSet &&
 
  375            for (
int i = 0; i < nel; ++i)
 
  379                cnt += 
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
 
  385            for (
int i = 0; i < nel; ++i)
 
  387                m_f->m_exp[0]->GetExp(i)->PhysInterpToSimplexEquiSpaced(
 
  388                    phys + cnt, tmp = pts[coordim + n] + cnt1);
 
  390                cnt += 
m_f->m_exp[0]->GetExp(i)->GetTotPoints();
 
  396        coordim, 
m_f->m_variables, pts);
 
  406    else if (shapedim == 3)
 
  410    m_f->m_fieldPts->SetConnectivity(ptsConn);
 
  417    m_f->m_fieldPts->SetPointsPerElement(ppe);
 
  420    m_f->m_exp = vector<MultiRegions::ExpListSharedPtr>();
 
  426    int nel          = 
m_f->m_exp[0]->GetPlane(0)->GetExpSize();
 
  427    int nPlanes      = 
m_f->m_exp[0]->GetZIDs().size();
 
  428    int npts         = 
m_f->m_fieldPts->GetNpoints();
 
  429    int nptsPerPlane = npts / nPlanes;
 
  432    if (
m_f->m_exp[0]->GetHomogeneousBasis()->GetBasisType() ==
 
  434        m_f->m_exp[0]->GetHomogeneousBasis()->GetPointsType() ==
 
  439        m_f->m_fieldPts->GetPts(pts);
 
  441        for (
int i = 0; i < pts.size(); i++)
 
  448            if (
m_f->m_comm->GetColumnComm()->GetSize() == 1)
 
  450                if (i == (coordim - 1))
 
  454                                pts[i], 1, extraPlane, 1);
 
  464                int size     = 
m_f->m_comm->GetColumnComm()->GetSize();
 
  465                int rank     = 
m_f->m_comm->GetColumnComm()->GetRank();
 
  466                int fromRank = (rank + 1) % size;
 
  467                int toRank   = (rank == 0) ? size - 1 : rank - 1;
 
  470                m_f->m_comm->GetColumnComm()->SendRecv(toRank, send, fromRank,
 
  473                if (i == (coordim - 1) && (rank == size - 1))
 
  476                                extraPlane, 1, extraPlane, 1);
 
  480        m_f->m_fieldPts->SetPts(newPts);
 
  482        vector<Array<OneD, int>> oldConn;
 
  484        m_f->m_fieldPts->GetConnectivity(oldConn);
 
  485        vector<Array<OneD, int>> newConn = oldConn;
 
  486        int connPerPlane                 = oldConn.size() / nPlanes;
 
  487        for (
int i = 0; i < connPerPlane; i++)
 
  490            for (
int j = 0; j < conn.size(); j++)
 
  492                conn[j] = oldConn[i][j] + npts;
 
  494            newConn.push_back(conn);
 
  496        m_f->m_fieldPts->SetConnectivity(newConn);
 
  499        npts += nptsPerPlane;
 
  502    vector<Array<OneD, int>> oldConn;
 
  503    vector<Array<OneD, int>> newConn;
 
  505    m_f->m_fieldPts->GetConnectivity(oldConn);
 
  510        for (
int i = 0; i < nel; ++i)
 
  512            int nLines = oldConn[i].size() / 2;
 
  517            for (
int n = 0; n < nLines; n++)
 
  520                for (
int p = 0; 
p < nPlanes - 1; 
p++)
 
  522                    conn[cnt++] = oldConn[i + 
p * nel][2 * n + 0];
 
  523                    conn[cnt++] = oldConn[i + 
p * nel][2 * n + 1];
 
  524                    conn[cnt++] = oldConn[i + (
p + 1) * nel][2 * n + 0];
 
  526                    conn[cnt++] = oldConn[i + 
p * nel][2 * n + 1];
 
  527                    conn[cnt++] = oldConn[i + (
p + 1) * nel][2 * n + 0];
 
  528                    conn[cnt++] = oldConn[i + (
p + 1) * nel][2 * n + 1];
 
  531            newConn.push_back(conn);
 
  538        for (
int i = 0; i < nel; ++i)
 
  540            e = 
m_f->m_exp[0]->GetPlane(0)->GetExp(i);
 
  542            int np0 = e->GetBasis(0)->GetNumPoints();
 
  543            int np1 = e->GetBasis(1)->GetNumPoints();
 
  544            int np  = max(np0, np1);
 
  545            maxN    = max(np, maxN);
 
  552        for (
int i = 0; i < nel; ++i)
 
  554            e       = 
m_f->m_exp[0]->GetPlane(0)->GetExp(i);
 
  555            int np0 = e->GetBasis(0)->GetNumPoints();
 
  556            int np1 = e->GetBasis(1)->GetNumPoints();
 
  557            int np  = max(np0, np1);
 
  558            switch (e->DetShapeType())
 
  567                    vId[cnt1]                 = e->GetGeom()->GetVid(0);
 
  568                    vId[cnt1 + np - 1]        = e->GetGeom()->GetVid(1);
 
  569                    vId[cnt1 + newpoints - 1] = e->GetGeom()->GetVid(2);
 
  575                    for (
int n = 1; n < np - 1; n++)
 
  578                        edgeOrient = e->GetGeom()->GetEorient(0);
 
  582                                4 * nel + maxN * e->GetGeom()->GetEid(0) + n;
 
  586                            vId[cnt1 + np - 1 - n] =
 
  587                                4 * nel + maxN * e->GetGeom()->GetEid(0) + n;
 
  591                        edgeOrient = e->GetGeom()->GetEorient(1);
 
  595                            vId[cnt1 + np - 1 + edge1] =
 
  596                                4 * nel + maxN * e->GetGeom()->GetEid(1) + n;
 
  601                            vId[cnt1 + newpoints - 1 - edge1] =
 
  602                                4 * nel + maxN * e->GetGeom()->GetEid(1) + n;
 
  606                        edgeOrient = e->GetGeom()->GetEorient(2);
 
  610                            vId[cnt1 + newpoints - 1 - edge2] =
 
  611                                4 * nel + maxN * e->GetGeom()->GetEid(2) + n;
 
  617                                4 * nel + maxN * e->GetGeom()->GetEid(2) + n;
 
  623                    for (
int n = 1; n < np - 1; n++)
 
  626                        for (
int m = 1; m < np - n - 1; m++)
 
  628                            vId[cnt1 + edge2 + m] =
 
  629                                4 * nel + maxN * 4 * nel + cnt2;
 
  642                    vId[cnt1]                 = e->GetGeom()->GetVid(0);
 
  643                    vId[cnt1 + np - 1]        = e->GetGeom()->GetVid(1);
 
  644                    vId[cnt1 + np * np - 1]   = e->GetGeom()->GetVid(2);
 
  645                    vId[cnt1 + np * (np - 1)] = e->GetGeom()->GetVid(3);
 
  649                    for (
int n = 1; n < np - 1; n++)
 
  652                        edgeOrient = e->GetGeom()->GetEorient(0);
 
  656                                4 * nel + maxN * e->GetGeom()->GetEid(0) + n;
 
  660                            vId[cnt1 + np - 1 - n] =
 
  661                                4 * nel + maxN * e->GetGeom()->GetEid(0) + n;
 
  665                        edgeOrient = e->GetGeom()->GetEorient(1);
 
  668                            vId[cnt1 + np - 1 + n * np] =
 
  669                                4 * nel + maxN * e->GetGeom()->GetEid(1) + n;
 
  673                            vId[cnt1 + np * np - 1 - n * np] =
 
  674                                4 * nel + maxN * e->GetGeom()->GetEid(1) + n;
 
  678                        edgeOrient = e->GetGeom()->GetEorient(2);
 
  681                            vId[cnt1 + np * np - 1 - n] =
 
  682                                4 * nel + maxN * e->GetGeom()->GetEid(2) + n;
 
  686                            vId[cnt1 + np * (np - 1) + n] =
 
  687                                4 * nel + maxN * e->GetGeom()->GetEid(2) + n;
 
  691                        edgeOrient = e->GetGeom()->GetEorient(3);
 
  694                            vId[cnt1 + np * (np - 1) - n * np] =
 
  695                                4 * nel + maxN * e->GetGeom()->GetEid(3) + n;
 
  700                                4 * nel + maxN * e->GetGeom()->GetEid(3) + n;
 
  705                    for (
int n = 1; n < np - 1; n++)
 
  707                        for (
int m = 1; m < np - 1; m++)
 
  709                            vId[cnt1 + m * np + n] =
 
  710                                4 * nel + maxN * 4 * nel + cnt2;
 
  719                    ASSERTL0(
false, 
"Points not known");
 
  725        for (
int i = 0; i < nel; ++i)
 
  727            int nTris = oldConn[i].size() / 3;
 
  732            for (
int n = 0; n < nTris; n++)
 
  735                int vId0 = vId[oldConn[i][3 * n + 0]];
 
  736                int vId1 = vId[oldConn[i][3 * n + 1]];
 
  737                int vId2 = vId[oldConn[i][3 * n + 2]];
 
  741                if ((vId0 < vId1) && (vId0 < vId2))
 
  755                else if ((vId1 < vId0) && (vId1 < vId2))
 
  785                for (
int p = 0; 
p < nPlanes - 1; 
p++)
 
  787                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[0]];
 
  788                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[1]];
 
  789                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[2]];
 
  790                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[2]];
 
  792                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[0]];
 
  793                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[1]];
 
  794                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[2]];
 
  795                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[1]];
 
  797                    conn[cnt2++] = oldConn[i + 
p * nel][3 * n + rot[0]];
 
  798                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[1]];
 
  799                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[2]];
 
  800                    conn[cnt2++] = oldConn[i + (
p + 1) * nel][3 * n + rot[0]];
 
  803            newConn.push_back(conn);
 
  808        ASSERTL0(
false, 
"Points type not supported.");
 
  811    m_f->m_fieldPts->SetConnectivity(newConn);
 
  819    e = 
m_f->m_exp[0]->GetExp(n);
 
  821    switch (e->DetShapeType())
 
  825            int np0 = e->GetBasis(0)->GetNumPoints();
 
  826            int np1 = e->GetBasis(1)->GetNumPoints();
 
  827            int np  = max(np0, np1);
 
  841                                   e->GetBasis(1)->GetBasisKey(), phys, Ba, Bb,
 
  849            int np0 = e->GetBasis(0)->GetNumPoints();
 
  850            int np1 = e->GetBasis(1)->GetNumPoints();
 
  851            int np  = max(np0, np1);
 
  863                                   e->GetBasis(1)->GetBasisKey(), phys, Ba, Bb,
 
  870            ASSERTL0(
false, 
"Shape needs setting up");
 
#define ASSERTL0(condition, msg)
 
FieldSharedPtr m_f
Field object.
 
std::map< std::string, ConfigOption > m_config
List of configuration values.
 
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
 
virtual ~ProcessEquiSpacedOutput()
 
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
 
ProcessEquiSpacedOutput(FieldSharedPtr f)
 
static ModuleKey className
 
void SetHomogeneousConnectivity(void)
 
void GenOrthoModes(int n, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &coeffs)
 
Abstract base class for processing modules.
 
Describes the specification for a Basis.
 
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
 
Defines a specification for a set of points.
 
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
 
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space.
 
std::shared_ptr< Field > FieldSharedPtr
 
std::pair< ModuleType, std::string > ModuleKey
 
ModuleFactory & GetModuleFactory()
 
int getNumberOfCoefficients(int Na, int Nb, int Nc)
 
int getNumberOfCoefficients(int Na, int Nb, int Nc)
 
int getNumberOfCoefficients(int Na, int Nb, int Nc)
 
int getNumberOfCoefficients(int Na, int Nb)
 
int getNumberOfCoefficients(int Na)
 
int getNumberOfCoefficients(int Na, int Nb, int Nc)
 
int getNumberOfCoefficients(int Na, int Nb)
 
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function  evaluated at the quadrature points of the 2D basis,...
 
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
 
@ eOrtho_A
Principle Orthogonal Functions .
 
@ eOrtho_B
Principle Orthogonal Functions .
 
@ eFourier
Fourier Expansion .
 
std::shared_ptr< Expansion > ExpansionSharedPtr
 
@ eDir1BwdDir2_Dir2BwdDir1
 
@ eDir1BwdDir1_Dir2BwdDir2
 
@ eDir1BwdDir2_Dir2FwdDir1
 
@ eDir1BwdDir1_Dir2FwdDir2
 
The above copyright notice and this permission notice shall be included.
 
static Array< OneD, NekDouble > NullNekDouble1DArray
 
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add scalar y = alpha + x.
 
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
 
Represents a command-line configuration option.