Skip to content

Commit

Permalink
indent and typo
Browse files Browse the repository at this point in the history
  • Loading branch information
holke committed Oct 14, 2024
1 parent 40246ad commit ef622db
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 187 deletions.
3 changes: 2 additions & 1 deletion src/t8_cmesh/t8_cmesh_commit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ t8_cmesh_commit (t8_cmesh_t cmesh, sc_MPI_Comm comm)
* but only if the vertex_to_tree instance is not yet committed
* and if the tree_to_vertex instance is not empty.
*/
if (cmesh->vertex_connectivity->get_vertex_to_tree_state () == 0 && cmesh->vertex_connectivity->get_tree_to_vertex_state () == 1) {
if (cmesh->vertex_connectivity->get_vertex_to_tree_state () == 0
&& cmesh->vertex_connectivity->get_tree_to_vertex_state () == 1) {
cmesh->vertex_connectivity->build_vertex_to_tree (cmesh);
}

Expand Down
3 changes: 2 additions & 1 deletion src/t8_cmesh/t8_cmesh_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ typedef struct t8_cmesh

t8_geometry_handler_c *geometry_handler; /**< Handles all geometries that are used by trees in this cmesh. */

struct t8_cmesh_vertex_connectivity *vertex_connectivity; /**< Structure that manages tree_to_vertex and vertex_to_tree connectivity. */
struct t8_cmesh_vertex_connectivity
*vertex_connectivity; /**< Structure that manages tree_to_vertex and vertex_to_tree connectivity. */

#ifdef T8_ENABLE_DEBUG
t8_locidx_t inserted_trees; /**< Count the number of inserted trees to
Expand Down
2 changes: 1 addition & 1 deletion src/t8_cmesh/t8_cmesh_vertex_conn_tree_to_vertex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ t8_cmesh_vertex_conn_tree_to_vertex::get_global_vertex (const t8_cmesh_t cmesh,
T8_ASSERT (local_tree_vertex < num_tree_vertices);

return get_global_vertices (cmesh, local_tree, num_tree_vertices)[local_tree_vertex];
}
}
121 changes: 59 additions & 62 deletions src/t8_cmesh/t8_cmesh_vertex_conn_tree_to_vertex.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
You should have received a copy of the GNU General Public License
along with t8code; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

*/

/** \file t8_cmesh_vertex_conn_tree_to_vertex.hxx
* Class to save data structure for tree_to_vertex_lists of the cmesh.
* When the cmesh stores global vertex numbers, we require a lookup that
* matches a tree and its local vertex to a global vertex id.
* This lookup is encoded in the t8_cmesh_vertex_conn_tree_to_vertex struct.
*/

*/

/* TODO:
* It is probably best to set all global ids of a single tree as one attribute.
* That way we can store it as a single arrays of id's.
Expand All @@ -35,73 +35,70 @@
* when accessing.
*
* On the downside we will only have a "set all ids of a tree" function and no "set this single id for this tree and this vertex" function.
*/

#pragma once

#include <algorithm>
#include <t8_cmesh.h>
#include <t8_cmesh/t8_cmesh_vertex_conn_vertex_to_tree.hxx>

/* forward declaration of ttv class needed since the two class headers include each other. */
class t8_cmesh_vertex_conn_vertex_to_tree;

class t8_cmesh_vertex_conn_tree_to_vertex
{
public:
/** Standard constructor. Does nothing. */
t8_cmesh_vertex_conn_tree_to_vertex (): state (EMPTY)
{
}

/** Constructor from a cmesh where all the attributes are set. */
t8_cmesh_vertex_conn_tree_to_vertex (const t8_cmesh_t cmesh)
{
SC_ABORT ("not implemented.");
}

*/

#pragma once

#include <algorithm>
#include <t8_cmesh.h>
#include <t8_cmesh/t8_cmesh_vertex_conn_vertex_to_tree.hxx>

/* forward declaration of ttv class needed since the two class headers include each other. */
class t8_cmesh_vertex_conn_vertex_to_tree;

class t8_cmesh_vertex_conn_tree_to_vertex {
public:
/** Standard constructor. Does nothing. */
t8_cmesh_vertex_conn_tree_to_vertex (): state (EMPTY)
{
}

/** Constructor from a cmesh where all the attributes are set. */
t8_cmesh_vertex_conn_tree_to_vertex (const t8_cmesh_t cmesh)
{
SC_ABORT ("not implemented.");
}

/** Constructor from a cmesh and a given vertex to tree connectivity.
*
* \note \a cmesh must not be committed.
* \note \a vtt must be committed.
* \note This does not work until issue #923 https://github.com/DLR-AMR/t8code/issues/923 is resolved.
*/
t8_cmesh_vertex_conn_tree_to_vertex (const t8_cmesh_t cmesh_from, const t8_cmesh_t cmesh,
const struct t8_cmesh_vertex_conn_vertex_to_tree &vtt);

/* Setter functions */
*/
t8_cmesh_vertex_conn_tree_to_vertex (const t8_cmesh_t cmesh_from, const t8_cmesh_t cmesh,
const struct t8_cmesh_vertex_conn_vertex_to_tree &vtt);

/* Setter functions */
/** Set all global vertex ids of a local tree.
* \param[in] cmesh The considered cmesh
* \param[in] local_tree A local tree id of \a cmesh
* \param[in] global_vertex_id The ids of the global vertices in order of \a local_tree's vertices.
* \param[in] num_vertices Must match the number of vertices of \a local_tree
*
* \note \a cmesh must not be committed.
*/
void
set_global_vertex_ids_of_tree_vertices (const t8_cmesh_t, const t8_gloidx_t global_tree,
const t8_gloidx_t *global_tree_vertices, const int num_vertices);

t8_gloidx_t
get_global_vertex (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, const int local_tree_vertex,
const int num_tree_vertices) const;

const t8_gloidx_t *
get_global_vertices (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, const int num_vertices) const;

const int
get_state ()
{
return state;
}

friend struct t8_cmesh_vertex_connectivity;

private:

enum {
EMPTY, /*< Is initialized but empty. */
FILLED /*< Is filled with at least one entry. */
} state;
};

*/
void
set_global_vertex_ids_of_tree_vertices (const t8_cmesh_t, const t8_gloidx_t global_tree,
const t8_gloidx_t *global_tree_vertices, const int num_vertices);

t8_gloidx_t
get_global_vertex (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, const int local_tree_vertex,
const int num_tree_vertices) const;

const t8_gloidx_t *
get_global_vertices (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, const int num_vertices) const;

const int
get_state ()
{
return state;
}

friend struct t8_cmesh_vertex_connectivity;

private:
enum {
EMPTY, /*< Is initialized but empty. */
FILLED /*< Is filled with at least one entry. */
} state;
};
7 changes: 3 additions & 4 deletions src/t8_cmesh/t8_cmesh_vertex_conn_vertex_to_tree.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@

/* Builds vertex_to_tree with existing tree_to_vertex list. */
void
t8_cmesh_vertex_conn_vertex_to_tree::build_from_ttv (
const t8_cmesh_t cmesh, t8_cmesh_vertex_conn_tree_to_vertex& ttv)
t8_cmesh_vertex_conn_vertex_to_tree::build_from_ttv (const t8_cmesh_t cmesh, t8_cmesh_vertex_conn_tree_to_vertex& ttv)
{
/* Call standard constructor */
T8_ASSERT (state == INITIALIZED);
Expand Down Expand Up @@ -112,7 +111,7 @@ t8_cmesh_vertex_conn_vertex_to_tree::commit (const t8_cmesh_t cmesh)

void
t8_cmesh_vertex_conn_vertex_to_tree::add_vertex_to_tree (const t8_cmesh_t cmesh, t8_gloidx_t global_vertex_id,
t8_locidx_t ltreeid, int tree_vertex)
t8_locidx_t ltreeid, int tree_vertex)
{
T8_ASSERT (!is_committed ());
T8_ASSERT (0 <= global_vertex_id);
Expand Down Expand Up @@ -223,4 +222,4 @@ t8_cmesh_vertex_conn_vertex_to_tree::contains_all_vertices (const t8_cmesh_t cme
}
}
return 1;
}
}
Loading

0 comments on commit ef622db

Please sign in to comment.