diff --git a/ConSol/ConSol/Mesh/MeshBase.cpp b/ConSol/ConSol/Mesh/MeshBase.cpp index f724957..543be51 100644 --- a/ConSol/ConSol/Mesh/MeshBase.cpp +++ b/ConSol/ConSol/Mesh/MeshBase.cpp @@ -1,212 +1,221 @@ // // MeshBase.cpp // ConserSolver // // Created by Fabian Moenkeberg on 04.05.17. // Copyright © 2017 FabianMoenkeberg. All rights reserved. // #include "MeshBase.hpp" int MeshBase::getNdims(){return ndims;}; std::vector MeshBase::getSize(){return size;}; std::vector MeshBase::getSize(std::vector i){ int n = i.size(); std::vector ret(n); for (int j = 0; j < n; j++){ ret[j] = size[j]; } return ret; } double MeshBase::getSize(int i){ return size[i]; } void MeshBase::setBoundaryNeighbours(Configuration config){}; void MeshBase::initialize(BcBase *bc, Configuration config){}; std::vector > MeshBase::evalFunc(AbstractFunct *Funct, evaluationMethod evalMethod){ std::vector> ret(0,std::vector(0)); return ret; }; void MeshBase::setStencils(Configuration config){}; std::vector MeshBase::MidPoint(int i){ std::vector midPts(0); return midPts; }; std::vector> MeshBase::netFlux(NetFlux* numFluxFct, std::vector>& U, std::vector > > &UReconstr, double t, double dt){ std::vector> ret(0,std::vector(0)); return ret; }; void MeshBase::netFlux(std::vector> &numFlux, NetFlux* numFluxFct, std::vector> &U, std::vector>>> &UReconstr, double t, double dt){ // std::vector> ret(0,std::vector(0)); // return ret; }; std::vector MeshBase::getInternal(){return this->internal;}; BcBase* MeshBase::getBc(){return bc;}; int MeshBase::getBCMap(int i){return bcMap[i];}; int MeshBase::getBCMap2(int i){return bcMap2[i];}; int MeshBase::getNelem(){return nelem;}; int MeshBase::getNedges(){return nedges;}; std::vector> MeshBase::getXCoord(){return xCoord;}; std::vector> MeshBase::getXCoordOfCell(int i){ std::vector cell = cells[i]; int nI = (int) cell.size(); std::vector> ret(nI,std::vector(ndims)); for (int j = 0; j < nI; j++){ ret[j] = xCoord[cell[j]]; } return ret; }; std::vector MeshBase::getXCoord(int i){return xCoord[i];}; std::vector> MeshBase::getXCoord(std::vector i){ int nI = (int) i.size(); std::vector> ret(nI,std::vector(ndims)); for (int j = 0; j < nI; j++){ ret[j] = xCoord[i[j]]; } return ret; }; std::vector> MeshBase::getCells(){return cells;}; std::vector MeshBase::getCells(int i){return cells[i];}; int MeshBase::getNcellsTot(){ return nCellsTot;}; int MeshBase::getNcells(){return nCells;}; int MeshBase::getInternal(int i){return internal[i];}; std::vector MeshBase::getC2E(int i) {return c2e[i];}; std::vector MeshBase::getC2E_internal(int i) {return c2e[internal[i]];}; std::vector> MeshBase::getStencils(int i){return stencils[i];}; int MeshBase::getRight(int i){return e2c[i][1];}; int MeshBase::getLeft(int i){return e2c[i][0];}; //std::vector> &MeshBase::getIndBCLeftIsOut(){return indBCLeftIsOut;}; // //std::vector> &MeshBase::getIndBCRightIsOut(){return indBCRightIsOut;}; std::vector> &MeshBase::getEdgesAtBC(){return edgesAtBC;}; std::vector &MeshBase::getEdgesAtBC(int i){return edgesAtBC[i];}; double MeshBase::getDxMin(int d) {return dxMin[d];}; std::vector MeshBase::getDxMin() {return dxMin;}; void MeshBase::updateEdges(std::vector>>> &UReconstr, double t){bc->updateEdges(UReconstr, this, t);}; void MeshBase::updateEdges(std::vector>>> &UReconstr, double t, int i){bc->updateEdges(UReconstr, this, t, i);}; std::vector> MeshBase::edge2Vertex(int i){ std::vector> ret(0,std::vector(0)); return ret; }; double MeshBase::getApproxStencilSize(std::vector i){ // double ret = 0; // for (auto const& it: i){ // ret += sqrt(size[it]); // } // return ret/2; double ret = sqrt(size[i[0]]); for (auto const& it: i){ ret = std::min(sqrt(size[it]), ret); } return ret; } std::vector MeshBase::getNeightbours(int i){ return neighbours[i];}; std::vector MeshBase::getEdge(int i){return edg[i];}; std::vector MeshBase::getNormal(int i){return normals[i];}; std::vector MeshBase::getDS(int i){return dS[i];}; MeshType MeshBase::getMeshType(){return meshType;}; int MeshBase::getNgc(){return ngc;}; int MeshBase::getNbc(){return bcMap.size()/3;}; int MeshBase::getNbc2(){return bcMap2.size()/3;}; int MeshBase::getNdomainsQUAD(){return nDomainsQUAD;}; int MeshBase::getNdomainsQUADQUAD(){return nDomainsQUADQUAD;}; int MeshBase::getNdomainsRQ(){return nDomainsRQ;}; int MeshBase::getNdomainsRT(){return nDomainsRT;}; int MeshBase::getNdomainsTRI(){return nDomainsTRI;}; int MeshBase::getNdomainsTRIQUAD(){return nDomainsTRIQUAD;}; std::vector MeshBase::getSubmeshCell0(){ assert(false && "Meshbase: Submesh not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getSubmeshEdg0(){ return submeshEdg0; }; std::vector MeshBase::getNx(){ assert(false && "Meshbase: Nx not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getNy(){ assert(false && "Meshbase: Ny not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getDx(){ assert(false && "Meshbase: Dx not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getDy(){ assert(false && "Meshbase: Dy not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getXmin(){ assert(false && "Meshbase: Xmin not implemented for this mesh kind!"); return std::vector(0); }; std::vector MeshBase::getYmin(){ assert(false && "Meshbase: Ymin not implemented for this mesh kind!"); return std::vector(0); +}; + +std::vector MeshBase::getMidPt(int iCell){ + assert(false && "Meshbase: Ymin not implemented for this mesh kind!"); + return std::vector(0); +}; + +int MeshBase::getNinternal(){ + return internal.size(); }; \ No newline at end of file diff --git a/ConSol/ConSol/Mesh/MeshBase.hpp b/ConSol/ConSol/Mesh/MeshBase.hpp index faf7dac..8cd123c 100644 --- a/ConSol/ConSol/Mesh/MeshBase.hpp +++ b/ConSol/ConSol/Mesh/MeshBase.hpp @@ -1,194 +1,198 @@ // // MeshBase.hpp // ConserSolver // // Created by Fabian Moenkeberg on 04.05.17. // Copyright © 2017 FabianMoenkeberg. All rights reserved. // #ifndef MeshBase_hpp #define MeshBase_hpp //class Configuration; class NumFlux; #include #include #include "../Mesh/BC/BcBase.hpp" #include #include "../Utility/AbstractFunct.hpp" //#include "NumFlux.hpp" #include "../Flux/NetFlux.hpp" //#include "ModelBase.hpp" #include "../Base/Configuration.hpp" //enum evaluationMethod{PTWISE, MEANVALUE}; class MeshBase { protected: int ndims; int nelem; int nedges; int nCells; std::vector xLim; std::vector> xCoord; std::vector> cells; std::vector> dS; int nCellsTot; int ngc = 0; std::vector> neighbours; std::vector size; std::vector>> stencils; std::vector internal; std::vector> normals; BcBase *bc; std::vector> c2e; std::vector> edg; std::vector> e2c; std::vector bcMap; std::vector bcMap2; //split mapping for fast hybrid mesh from two TRI to one QUAD. std::vector> edgesAtBC; std::vector dxMin; std::vector> flux; int nThreads = 1; MeshType meshType; int nDomainsQUAD; int nDomainsTRI; int nDomainsTRIQUAD; int nDomainsQUADQUAD; int nDomainsRQ; int nDomainsRT; std::vector submeshEdg0; public: MeshBase(){}; virtual ~MeshBase(){}; virtual void setBoundaryNeighbours(Configuration config); virtual void initialize(BcBase *bc, Configuration config); virtual std::vector > evalFunc(AbstractFunct *Funct, evaluationMethod evalMethod); virtual void setStencils(Configuration config); virtual std::vector MidPoint(int i); virtual std::vector> netFlux(NetFlux* numFluxFct, std::vector> &U, std::vector>> &UReconstr, double t, double dt); virtual void netFlux(std::vector> &numFlux, NetFlux* numFluxFct, std::vector> &U, std::vector>>> &UReconstr, double t, double dt); int getNdims(); std::vector getSize(); std::vector getSize(std::vector i); double getSize(int i); double getApproxStencilSize(std::vector i); std::vector getInternal(); int getInternal(int i); + + int getNinternal(); BcBase* getBc(); int getBCMap(int i); int getBCMap2(int i); int getNelem(); int getNedges(); std::vector> getXCoord(); std::vector getXCoord(int i); virtual std::vector> getXCoordOfCell(int i); std::vector> getXCoord(std::vector i); std::vector> getCells(); std::vector getCells(int i); int getNcellsTot(); int getNcells(); std::vector getC2E(int i); std::vector getC2E_internal(int i); std::vector> getStencils(int i); // std::vector> &getIndBCLeftIsOut(); // // std::vector> &getIndBCRightIsOut(); int getRight(int i); int getLeft(int i); double getDxMin(int d); std::vector getDxMin(); void updateEdges(std::vector>>> &UReconstr, double t); void updateEdges(std::vector>>> &UReconstr, double t, int i); virtual std::vector> edge2Vertex(int i); std::vector> &getEdgesAtBC(); std::vector &getEdgesAtBC(int i); std::vector getNeightbours(int i); std::vector getEdge(int i); std::vector getNormal(int i); std::vector getDS(int i); MeshType getMeshType(); int getNgc(); int getNbc(); int getNbc2(); int getNdomainsQUAD(); int getNdomainsQUADQUAD(); int getNdomainsRQ(); int getNdomainsRT(); int getNdomainsTRI(); int getNdomainsTRIQUAD(); virtual std::vector getSubmeshCell0(); virtual std::vector getSubmeshEdg0(); virtual std::vector getNx(); virtual std::vector getNy(); virtual std::vector getDx(); virtual std::vector getDy(); virtual std::vector getXmin(); virtual std::vector getYmin(); + + virtual std::vector getMidPt(int iCell); }; #endif /* MeshBase_hpp */