C++ (Cpp) u32arr3vector Example

Introduction

The c++ (cpp) u32arr3vector example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: C++ (Cpp)

Class/type: u32arr3vector

Example#1
File: Octant.cppProject: uncleTes/BitP_Mesh

/*! Get the coordinates of the nodes of an octant in logical domain.
 * \param[out] nodes Vector of arrays [nnodes][3] with the coordinates of the nodes of octant.
 */
void
Octant::getNodes(u32arr3vector & nodes) const {
    uint8_t		i, cx, cy, cz;
    uint32_t	dh;
    uint8_t nn = 1<<m_dim;

    dh = getSize();
    nodes.resize(nn);

    for (i = 0; i < nn; i++) {
        cx = uint8_t(i%2);
        cy = uint8_t((i-4*(i/4))/2);
        cz = uint8_t(i/4);
        nodes[i][0] = m_x + cx*dh;
        nodes[i][1] = m_y + cy*dh;
        nodes[i][2] = m_z + cz*dh;
    }
};

Example#2
File: Octant.cppProject: optimad/BitP_Mesh

/*! Get the coordinates of the nodes of an octant in logical domain.
 * \param[out] nodes Vector of arrays [nnodes][3] with the coordinates of the nodes of octant.
 */
void
Octant::getNodes(u32arr3vector & nodes) const{
	uint8_t		i; // cx, cy, cz;
	uint32_t	dh;
	uint8_t nn = 1<<m_dim;

	dh = getSize();
	nodes.resize(nn);

	for (i = 0; i < nn; i++){
//		cx = uint8_t(i%2);
//		cy = uint8_t((i-4*(i/4))/2);
//		cz = uint8_t(i/4);

		nodes[i][0] = m_x + sm_CoeffNode[i][0]*dh;
		nodes[i][1] = m_y + sm_CoeffNode[i][1]*dh;
		nodes[i][2] = m_z + sm_CoeffNode[i][2]*dh;
	}
};