Skip to content

Commit

Permalink
Merge a499723 into 12372be
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Oct 30, 2020
2 parents 12372be + a499723 commit ad1e023
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 74 deletions.
6 changes: 4 additions & 2 deletions src/libs/blueprint/conduit_blueprint_mesh.cpp
Expand Up @@ -1881,7 +1881,7 @@ calculate_unstructured_centroids(const conduit::Node &topo,
Node data_node;
for(index_t ei = 0; ei < topo_num_elems; ei++)
{
index_t esize;
index_t esize = 0;
if (topo_shape.is_polygonal())
{
data_node.set_external(size_dtype, topo_sizes.element_ptr(ei));
Expand All @@ -1902,7 +1902,9 @@ calculate_unstructured_centroids(const conduit::Node &topo,
fi < elem_num_faces; fi++)
{

index_t subelem_index, subelem_offset, subelem_size = 0;
index_t subelem_index = 0;
index_t subelem_offset = 0;
index_t subelem_size = 0;
if (topo_shape.is_polyhedral())
{
data_node.set_external(conn_dtype, topo_conn.element_ptr(foffset));
Expand Down
2 changes: 1 addition & 1 deletion src/libs/blueprint/conduit_blueprint_mesh_examples.cpp
Expand Up @@ -2841,7 +2841,7 @@ misc(const std::string &mesh_type,
void
adjset_uniform(Node &res)
{
for(index_t i = 0; i < 8; i++)
for(int32 i = 0; i < 8; i++)
{
std::ostringstream oss;
oss << "domain_" << std::setfill('0') << std::setw(6) << i;
Expand Down
41 changes: 21 additions & 20 deletions src/libs/blueprint/conduit_blueprint_mesh_examples_julia.cpp
Expand Up @@ -141,8 +141,8 @@ void paint_2d_nestsets(conduit::Node &domain,
}
else if(coords["type"].as_string() == "rectilinear")
{
el_dims[0] = coords["values/x"].dtype().number_of_elements() - 1;
el_dims[1] = coords["values/y"].dtype().number_of_elements() - 1;
el_dims[0] = (int)(coords["values/x"].dtype().number_of_elements() - 1);
el_dims[1] = (int)(coords["values/y"].dtype().number_of_elements() - 1);
}
else
{
Expand Down Expand Up @@ -177,8 +177,8 @@ void paint_2d_nestsets(conduit::Node &domain,
if(nest_id == -1) return;

const Node &nestset = domain["nestsets"].child(nest_id);
const int windows = nestset["windows"].number_of_children();
for(int i = 0; i < windows; ++i)
const index_t windows = nestset["windows"].number_of_children();
for(index_t i = 0; i < windows; ++i)
{
const Node &window = nestset["windows"].child(i);
if(window["domain_type"].as_string() != "child")
Expand Down Expand Up @@ -233,7 +233,7 @@ void gap_scanner(const std::vector<int32> &values,
{
if(gap_length > gap[1])
{
gap[0] = i + offset;
gap[0] = (int32)(i + offset);
gap[1] = gap_length;
}
in_gap = false;
Expand Down Expand Up @@ -262,7 +262,7 @@ void inflection_scanner(const std::vector<int32> &values,
int32 mag = abs(deriv - prev);
if(mag > crit[1])
{
crit[0] = i + offset;
crit[0] = (int32)(i + offset);
crit[1] = mag;
}
}
Expand All @@ -284,7 +284,7 @@ struct AABB
box[2][1] = std::numeric_limits<index_t>::min();
}

bool valid(int axis)
bool valid(index_t axis)
{
return box[axis][0] <= box[axis][1];
}
Expand All @@ -308,27 +308,27 @@ struct AABB
<<"("<<box[1][0]<<","<<box[1][0]<<")\n";
}

int length(int axis)
index_t length(index_t axis)
{
return (box[axis][1] - box[axis][0] + 1);
}

int min(int axis)
index_t min(index_t axis)
{
return box[axis][0];
}

int max(int axis)
index_t max(index_t axis)
{
return box[axis][1];
}

void split(const int axis,
const int index,
void split(const index_t axis,
const index_t index,
AABB &left,
AABB &right)
{
for(int i = 0; i < 3; ++i)
for(index_t i = 0; i < 3; ++i)
{
if(i == axis)
{
Expand All @@ -355,13 +355,13 @@ struct AABB

void mid_split(AABB &left, AABB &right)
{
int axis = 0;
int len = 0;
for(int i = 0; i < 3; i++)
index_t axis = 0;
index_t len = 0;
for(index_t i = 0; i < 3; i++)
{
if(valid(i))
{
int size = length(i);
index_t size = length(i);
if(size > len)
{
axis = i;
Expand All @@ -370,7 +370,7 @@ struct AABB
}
}

int pos = len/2 + box[axis][0] - 1;
index_t pos = len/2 + box[axis][0] - 1;
split(axis, pos, left, right);
}

Expand Down Expand Up @@ -574,7 +574,7 @@ void julia(index_t nx,

int32 refine(int32 domain_index,
int32 domain_id_start,
float32 threshold,
float64 threshold,
float64 efficiency,
int32 min_size,
float64 c_re,
Expand Down Expand Up @@ -615,6 +615,7 @@ int32 refine(int32 domain_index,
float32 ddx = std::abs(x_vals[0] - 2.f * x_vals[1] + x_vals[2]);
float32 ddy = std::abs(y_vals[0] - 2.f * y_vals[1] + y_vals[2]);
float32 eps = sqrt(ddx*ddx + ddy*ddy);
// TODO, should der be a floating point # here?
der[i] = eps;
if(eps > threshold)
{
Expand Down Expand Up @@ -692,7 +693,7 @@ int32 refine(int32 domain_index,
cwindow["ratio/i"] = 2;
cwindow["ratio/j"] = 2;
}
return boxs.size();
return (int32)boxs.size();
}

void julia_nestsets_complex(index_t nx,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/blueprint/conduit_blueprint_mesh_examples_venn.cpp
Expand Up @@ -179,7 +179,7 @@ void build_material_sparse(Node & src, index_t len,
{
if (src_val[idx] > 0)
{
sparse_element_ids[sparse_idx] = idx;
sparse_element_ids[sparse_idx] = (int32)idx;
sparse_val[sparse_idx] = src_val[idx];

matset_area_val[sparse_idx] = element_area;
Expand Down Expand Up @@ -304,7 +304,7 @@ void venn_sparse_by_material_matset(Node &res)
float64 fgvf = cir_a[idx] + cir_b[idx] + cir_c[idx];
if (fgvf < 1.)
{
bg_idx[nidx] = idx;
bg_idx[nidx] = (int32)idx;

bg_val[nidx] = 1. - fgvf;

Expand Down Expand Up @@ -433,7 +433,7 @@ void venn_sparse_by_element_matset(Node &res)
}

sizes[idx] = size;
offsets[idx] = vfidx;
offsets[idx] = (int32) vfidx;
vfidx += size;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libs/blueprint/conduit_blueprint_o2mrelation.cpp
Expand Up @@ -189,7 +189,7 @@ void compact_to(const conduit::Node &o2mrelation,
else
{
O2MIterator o2miter(o2mrelation);
const std::vector<std::string> o2m_paths =
const std::vector<std::string> o2m_paths_curr =
conduit::blueprint::o2mrelation::data_paths(o2mrelation);

const conduit::Node &o2m_offsets = o2mrelation["offsets"];
Expand All @@ -203,9 +203,9 @@ void compact_to(const conduit::Node &o2mrelation,
res_offsets.set(conduit::DataType(offsets_dtype.id(),
o2miter.elements(conduit::blueprint::o2mrelation::ONE)));

for(index_t pi = 0; pi < (index_t)o2m_paths.size(); pi++)
for(index_t pi = 0; pi < (index_t)o2m_paths_curr.size(); pi++)
{
const std::string& o2m_path = o2m_paths[pi];
const std::string& o2m_path = o2m_paths_curr[pi];
res[o2m_path].set(conduit::DataType(o2mrelation[o2m_path].dtype().id(),
o2miter.elements(conduit::blueprint::o2mrelation::DATA)));
}
Expand All @@ -227,10 +227,10 @@ void compact_to(const conduit::Node &o2mrelation,
o2miter.next(conduit::blueprint::o2mrelation::MANY);
const index_t data_index = o2miter.index(conduit::blueprint::o2mrelation::DATA);

for(index_t pi = 0; pi < (index_t)o2m_paths.size(); pi++, curr_index++)
for(index_t pi = 0; pi < (index_t)o2m_paths_curr.size(); pi++, curr_index++)
{
const conduit::Node &o2m_data = o2mrelation[o2m_paths[pi]];
conduit::Node &res_data = res[o2m_paths[pi]];
const conduit::Node &o2m_data = o2mrelation[o2m_paths_curr[pi]];
conduit::Node &res_data = res[o2m_paths_curr[pi]];

const conduit::DataType data_dtype(o2m_data.dtype().id(), 1);
o2m_temp.set_external(data_dtype, (void*)o2m_data.element_ptr(data_index));
Expand Down
8 changes: 4 additions & 4 deletions src/libs/blueprint/conduit_blueprint_o2mrelation_examples.cpp
Expand Up @@ -116,8 +116,8 @@ uniform(Node &res,
for(index_t many_idx = 0; many_idx < nmany; many_idx++, datum_idx++)
{
res_data[one_idx * noffset + many_idx] = datum_idx + 1.0f;
res_indices[datum_idx] = many_idx + noffset *
( !rev_indices ? one_idx : nones - one_idx - 1 );
res_indices[datum_idx] = (uint32)(many_idx + noffset *
( !rev_indices ? one_idx : nones - one_idx - 1 ));
}
}

Expand All @@ -132,14 +132,14 @@ uniform(Node &res,
uint32_array res_sizes = res["sizes"].value();
for(index_t one_idx = 0; one_idx < nones; one_idx++)
{
res_sizes[one_idx] = nmany;
res_sizes[one_idx] = (uint32) nmany;
}

res["offsets"].set(DataType::uint32(nones));
uint32_array res_offsets = res["offsets"].value();
for(index_t one_idx = 0; one_idx < nones; one_idx++)
{
res_offsets[one_idx] = use_indices ? one_idx * nmany : one_idx * noffset;
res_offsets[one_idx] =(uint32)(use_indices ? one_idx * nmany : one_idx * noffset);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/libs/conduit/conduit_schema.cpp
Expand Up @@ -1241,11 +1241,11 @@ Schema::name() const
if(p->dtype().is_object())
{
// use name
std::string name = p->child_name(idx);
std::string cld_name = p->child_name(idx);

// check if name() includes "/", if so we need to escape
bool escape = false;
if(name.find('/') != std::string::npos)
if(cld_name.find('/') != std::string::npos)
{
escape = true;
}
Expand All @@ -1255,7 +1255,7 @@ Schema::name() const
oss << "{";
}

oss << name;
oss << cld_name;

if(escape)
{
Expand Down
7 changes: 4 additions & 3 deletions src/libs/conduit/conduit_utils.cpp
Expand Up @@ -1072,14 +1072,15 @@ hash(const char *k, unsigned int length, unsigned int initval)
unsigned int
hash(const char *k, unsigned int initval)
{
return hashing::Hash((unsigned char const*)k, strlen(k), initval);
return hashing::Hash((unsigned char const*)k,
(unsigned int)strlen(k), initval);
}

unsigned int
hash(const std::string &k, unsigned int initval)
{
return hashing::Hash((unsigned char const*)k.c_str(),
k.size(), initval);
return hashing::Hash((unsigned char const*)k.c_str(),
(unsigned int)k.size(), initval);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/conduit/python/conduit_python.cpp
Expand Up @@ -6347,9 +6347,9 @@ PyConduit_Node_Set_From_Numpy_Unicode_Array(Node &node,

// get unicode data and construct a python unicode object from it
void *unicode_buffer_ptr = PyArray_GETPTR1(py_arr,i);

int unicode_str_len = ((int)(buffer_len)) / 4;
PyObject *py_temp_unicode = PyUnicode_From_UTF32_Unicode_Buffer((const char*)unicode_buffer_ptr,
buffer_len/4);
unicode_str_len);

if(py_temp_unicode == NULL)
{
Expand Down

0 comments on commit ad1e023

Please sign in to comment.