MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / gridFluid

Method gridFluid

SRC/element/PFEMElement/BackgroundMesh.cpp:1786–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1784}
1785
1786int BackgroundMesh::gridFluid() {
1787 Domain* domain = OPS_GetDomain();
1788 if (domain == 0) return 0;
1789 int ndm = OPS_GetNDM();
1790
1791 // store cells in a vector
1792 std::vector<BCell*> cells;
1793 VVInt indices;
1794 cells.reserve(bcells.size());
1795 indices.reserve(bcells.size());
1796 for (std::map<VInt, BCell>::iterator it = bcells.begin();
1797 it != bcells.end(); ++it) {
1798 indices.push_back(it->first);
1799 cells.push_back(&(it->second));
1800 }
1801
1802 // create elements in each cell
1803 bool use_center_node = true;
1804 int numele = 0;
1805 int numelenodes = 0;
1806 if (ndm == 2) {
1807 if (use_center_node) {
1808 numele = 4;
1809 } else {
1810 numele = 2;
1811 }
1812 numelenodes = 3;
1813 } else if (ndm == 3) {
1814 if (use_center_node) {
1815 numele = 12;
1816 } else {
1817 numele = 6;
1818 }
1819 numelenodes = 4;
1820 }
1821 VVInt elends(numele * cells.size());
1822 VInt gtags(numele * cells.size());
1823 int ndtag = Mesh::nextNodeTag();
1824// #pragma omp parallel for
1825// TODO: setCenterNode will add nodes to domain. Can't be in parallel.
1826 for (int j = 0; j < (int)cells.size(); ++j) {
1827 // structural cell
1828 if (cells[j]->getType() == BACKGROUND_STRUCTURE) continue;
1829
1830 // find the group of this mesh
1831 std::map<int, int> numpts;
1832 auto& pts = cells[j]->getPts();
1833 for (int i = 0; i < (int)pts.size(); ++i) {
1834 numpts[pts[i]->getGroupTag()] += 1;
1835 }
1836 int num = 0;
1837 int gtag = 0;
1838 for (std::map<int, int>::iterator it = numpts.begin();
1839 it != numpts.end(); ++it) {
1840 if (num < it->second) {
1841 num = it->second;
1842 gtag = it->first;
1843 }

Callers

nothing calls this directly

Calls 15

OPS_getMeshFunction · 0.85
push_backMethod · 0.80
getGroupTagMethod · 0.80
getNodesMethod · 0.80
emptyMethod · 0.80
setCenterNodeMethod · 0.80
setEleNodesMethod · 0.80
newElementsMethod · 0.80
OPS_GetNDMFunction · 0.70
OPS_GetDomainFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected