Commit d6359d5c authored by vijaysm's avatar vijaysm
Browse files

Merged in vijaysm/remove-verbose-errors (pull request #261)

Remove verbose error outputs
parents 44b9e0de 5116a633
......@@ -785,24 +785,26 @@ namespace moab{
timeall.tm_refine += tm->time_elapsed() - tstart;
// Go into parallel communication
if (!optimize) {
#ifdef MOAB_HAVE_MPI
if (pcomm && (pcomm->size()> 1) && !optimize)
{
if (pcomm && (pcomm->size()> 1)) {
double tpstart = tm->time_elapsed();
error = resolve_shared_ents_parmerge(l, hm_set[l]);MB_CHK_ERR(error);
timeall.tm_resolve += tm->time_elapsed() - tpstart;
}
#endif
}
}
if (optimize) {
#ifdef MOAB_HAVE_MPI
if (pcomm && (pcomm->size()> 1)&& optimize)
{
double tpstart = tm->time_elapsed();
error = resolve_shared_ents_opt(hm_set, nlevels);MB_CHK_ERR(error);
timeall.tm_resolve = tm->time_elapsed() - tpstart;
}
if (pcomm && (pcomm->size()> 1)) {
double tpstart = tm->time_elapsed();
error = resolve_shared_ents_opt(hm_set, nlevels);MB_CHK_ERR(error);
timeall.tm_resolve = tm->time_elapsed() - tpstart;
}
#endif
}
timeall.tm_total = timeall.tm_refine + timeall.tm_resolve;
return MB_SUCCESS;
......@@ -1922,14 +1924,13 @@ namespace moab{
* Parallel Communication *
* ********************************/
#ifdef MOAB_HAVE_MPI
ErrorCode NestedRefine::resolve_shared_ents_parmerge(int level, EntityHandle levelset)
{
// TEMP: Add the adjacencies for MOAB-native DS
// NOTE (VSM): This is expensive since it creates a doubly
// redundant copy of the adjacency data in both MOAB-native
// and AHF. Need to fix this with AHF optimized branch.
#ifdef MOAB_HAVE_MPI
ErrorCode error;
ReadUtilIface *read_iface;
error = mbImpl->query_interface(read_iface);MB_CHK_ERR(error);
......@@ -1992,15 +1993,11 @@ namespace moab{
}
}
#else
MB_SET_ERR(MB_FAILURE, "Resolving shared interface for serial mesh");
#endif
return MB_SUCCESS;
}
ErrorCode NestedRefine::resolve_shared_ents_opt(EntityHandle *hm_set, int num_levels)
{
#ifdef MOAB_HAVE_MPI
assert(pcomm->size() > 1);
ErrorCode error;
......@@ -2019,13 +2016,11 @@ namespace moab{
//All shared processors
std::set<unsigned int> shprocs;
error = pcomm->get_comm_procs(shprocs);MB_CHK_ERR(error);
// std::cout<<"#shprocs = "<<shprocs.size()<<std::endl;
std::vector<int> sharedprocs;
for (std::set<unsigned int>::iterator it = shprocs.begin(); it != shprocs.end(); it++)
sharedprocs.push_back(*it);
int nprocs = sharedprocs.size();
// std::cout<<"nprocs = "<<nprocs<<std::endl;
//Create buffer variables storing the entities to be sent and received
std::vector<std::vector<int> > nsharedEntsperproc(nprocs);
......@@ -2046,17 +2041,11 @@ namespace moab{
Range allEnts;
error = collect_shared_entities_by_dimension(sharedentities, allEnts);MB_CHK_ERR(error);
// std::cout<<"collect_shared_entities_by_dimension"<<std::endl;
Range V0, E0, F0;
V0 = allEnts.subset_by_dimension(0);
E0 = allEnts.subset_by_dimension(1);
F0 = allEnts.subset_by_dimension(2);
// std::cout<<"#sharedFaces with proc = "<<sharedprocs[i]<<" :: "<<F0.size()<<std::endl;
// std::cout<<"#sharedEdges with proc = "<<sharedprocs[i]<<" :: "<<E0.size()<<std::endl;
// std::cout<<"#sharedVerts with proc = "<<sharedprocs[i]<<" :: "<<V0.size()<<std::endl;
// Step 2A: Prepare msg to be sent:
//
// FList = <F, FC, FE> where F, FC and FE are vectors containing the faces, their connectivities and edges.
......@@ -2103,9 +2092,6 @@ namespace moab{
msgsz.push_back(V0.size()); msgsz.push_back(locVList.size());
nsharedEntsperproc[i].insert(nsharedEntsperproc[i].end(),msgsz.begin(), msgsz.end());
// for (int j=0; j<msgsz.size(); j++)
// std::cout<<"msg_sizes["<<j<<"] = "<<msgsz[j]<<std::endl;
if (!F0.empty())
{
localBuffs[i].insert(localBuffs[i].end(), locFList.begin(), locFList.end());
......@@ -2134,13 +2120,11 @@ namespace moab{
// Step 6: Update pcomm tags
error = update_parallel_tags(rprocs, rhandles);MB_CHK_ERR(error);
#else
MB_SET_ERR(MB_FAILURE, "Resolving shared interface for serial mesh");
#endif
return MB_SUCCESS;
}
ErrorCode NestedRefine::collect_shared_entities_by_dimension(Range sharedEnts, Range &allEnts)
{
ErrorCode error;
......@@ -2209,7 +2193,6 @@ namespace moab{
ErrorCode NestedRefine::collect_FList(int to_proc, Range faces, std::vector<EntityHandle> &FList, std::vector<EntityHandle> &RList)
{
#ifdef MOAB_HAVE_MPI
ErrorCode error;
FList.clear();
......@@ -2277,9 +2260,6 @@ namespace moab{
RList.insert(RList.end(), FC.begin(), FC.end());
RList.insert(RList.end(), rFE.begin(), rFE.end());
RList.insert(RList.end(), FE.begin(), FE.end());
#else
MB_SET_ERR(MB_FAILURE, "Requesting collection of faces on shared interface for serial mesh");
#endif
return MB_SUCCESS;
}
......@@ -2287,7 +2267,6 @@ namespace moab{
ErrorCode NestedRefine::collect_EList(int to_proc, Range edges, std::vector<EntityHandle> &EList, std::vector<EntityHandle> &RList)
{
#ifdef MOAB_HAVE_MPI
ErrorCode error;
EList.clear();
std::vector<EntityHandle> E, EC, lE, lEC, rE, rEC;
......@@ -2340,9 +2319,6 @@ namespace moab{
RList.insert(RList.end(), E.begin(), E.end());
RList.insert(RList.end(), rEC.begin(), rEC.end());
RList.insert(RList.end(), EC.begin(), EC.end());
#else
MB_SET_ERR(MB_FAILURE, "Requesting collection of edges on shared interface for serial mesh");
#endif
return MB_SUCCESS;
}
......@@ -2350,23 +2326,18 @@ namespace moab{
ErrorCode NestedRefine::collect_VList(int to_proc, Range verts, std::vector<EntityHandle> &VList, std::vector<EntityHandle> &RList)
{
#ifdef MOAB_HAVE_MPI
ErrorCode error;
std::vector<EntityHandle> V, lV, rV;
VList.clear();
// std::cout<<"shared_proc = "<<to_proc<<std::endl;
//Add the vertices at the coarsest level first.
for (Range::iterator it = verts.begin(); it != verts.end(); it++)
{
EntityHandle v = *it;
// std::cout<<"v = "<<v<<std::endl;
lV.push_back(v);
EntityHandle rval = 0;
error = pcomm->get_remote_handles(&v, &rval, 1, to_proc);MB_CHK_ERR(error);
// std::cout<<"rv = "<<rval<<std::endl;
rV.push_back(rval);
}
......@@ -2390,23 +2361,9 @@ namespace moab{
RList.insert(RList.end(), rV.begin(), rV.end());
RList.insert(RList.end(), V.begin(), V.end());
//DBG
// std::cout<<"shared_proc = "<<to_proc<<std::endl;
//std::cout<<"|VList| = "<<VList.size()<<std::endl;
// std::cout<<"|RList| = "<<RList.size()<<std::endl;
// for (int i=0; i<VList.size(); i++)
// std::cout<<"VList["<<i<<"] = "<<VList[i]<<", RList["<<i<<"] = "<<RList[i]<<std::endl;
//DBG
#else
MB_SET_ERR(MB_FAILURE, "Requesting collection of vertices on shared interface for serial mesh");
#endif
return MB_SUCCESS;
}
ErrorCode NestedRefine::decipher_remote_handles(std::vector<int> &sharedprocs, std::vector<std::vector<int> > &auxinfo, std::vector<std::vector<EntityHandle> > &localbuffers, std::vector<std::vector<EntityHandle> > &remotebuffers, std::multimap<EntityHandle, int> &remProcs, std::multimap<EntityHandle, EntityHandle> &remHandles)
{
ErrorCode error;
......@@ -2488,17 +2445,6 @@ namespace moab{
LVList.insert(LVList.end(), localbuffers[i].begin(), localbuffers[i].end());
RVList.insert(RVList.end(), remotebuffers[i].begin(), remotebuffers[i].end());
//DBG
//std::cout<<"|LVList| = "<<LVList.size()<<", |RVList| = "<<RVList.size()<<std::endl;
// std::cout<<"from_proc = "<<sharedprocs[i]<<std::endl;
// for (int j=0; j<LVList.size(); j++)
// std::cout<<"LVList["<<j<<"] = "<<LVList[j]<<std::endl;
// for (int j=0; j<RVList.size(); j++)
// std::cout<<"RVList["<<j<<"] = "<<RVList[j]<<std::endl;
//DBG
error = decipher_remote_handles_vertex(sharedprocs[i], msgsz[4], LVList, RVList, remProcs, remHandles);MB_CHK_ERR(error);
}
else
......@@ -2618,7 +2564,6 @@ namespace moab{
}
}
return MB_SUCCESS;
}
......@@ -2761,7 +2706,6 @@ namespace moab{
ErrorCode NestedRefine::update_parallel_tags(std::multimap<EntityHandle, int> &remProcs, std::multimap<EntityHandle, EntityHandle> & remHandles)
{
#ifdef MOAB_HAVE_MPI
ErrorCode error;
std::vector<int> rprocs;
......@@ -2798,9 +2742,7 @@ namespace moab{
it = remProcs.upper_bound(it->first);
}
#else
MB_SET_ERR(MB_FAILURE, "Requesting updation of parallel tags for serial mesh");
#endif
return MB_SUCCESS;
}
......@@ -3018,6 +2960,8 @@ namespace moab{
return MB_SUCCESS;
}
#endif
/**********************************
* Update AHF maps *
......
This diff is collapsed.
......@@ -27,24 +27,6 @@
namespace moab {
inline
static ErrorCode not_found(const std::string& /*name*/, EntityHandle /*h*/)
{
// MB_TAG_NOT_FOUND could be a non-error condition, do not call MB_SET_ERR on it
// Print warning messages for debugging only
#if 0
if (h)
fprintf(stderr, "[Warning]: No sparse tag %s value for %s %lu\n",
name.c_str(),
CN::EntityTypeName(TYPE_FROM_HANDLE(h)),
(unsigned long)ID_FROM_HANDLE(h));
else
fprintf(stderr, "[Warning]: No sparse tag %s value for root set\n", name.c_str());
#endif
return MB_TAG_NOT_FOUND;
}
SparseTag::SparseTag(const char* name,
int size,
DataType type,
......@@ -117,14 +99,14 @@ ErrorCode SparseTag::get_data(Error* /* error */, EntityHandle entity_handle, vo
return MB_SUCCESS;
}
else
return not_found(get_name(), entity_handle);
return MB_TAG_NOT_FOUND;
}
ErrorCode SparseTag::remove_data(Error* /* error */, EntityHandle entity_handle)
{
MapType::iterator i = mData.find(entity_handle);
if (i == mData.end())
return not_found(get_name(), entity_handle);
if (i == mData.end())
return MB_TAG_NOT_FOUND;
mAllocator.destroy(i->second);
mData.erase(i);
......@@ -141,7 +123,8 @@ ErrorCode SparseTag::get_data(const SequenceManager*,
ErrorCode rval;
unsigned char* ptr = reinterpret_cast<unsigned char*>(data);
for (size_t i = 0; i < num_entities; ++i, ptr += get_size()) {
rval = get_data(NULL, entities[i], ptr);MB_CHK_ERR(rval);
rval = get_data(NULL, entities[i], ptr);
if (MB_SUCCESS != rval) return rval;
}
return MB_SUCCESS;
......@@ -156,7 +139,8 @@ ErrorCode SparseTag::get_data(const SequenceManager*,
unsigned char* ptr = reinterpret_cast<unsigned char*>(data);
Range::const_iterator i;
for (i = entities.begin(); i != entities.end(); ++i, ptr += get_size()) {
rval = get_data(NULL, *i, ptr);MB_CHK_ERR(rval);
rval = get_data(NULL, *i, ptr);
if (MB_SUCCESS != rval) return rval;
}
return MB_SUCCESS;
......@@ -181,7 +165,7 @@ ErrorCode SparseTag::get_data(const SequenceManager*,
*pointers = get_default_value();
}
else if (MB_SUCCESS != rval_tmp) {
rval = not_found(get_name(), entities[i]);
return MB_TAG_NOT_FOUND;
}
}
......@@ -207,7 +191,7 @@ ErrorCode SparseTag::get_data(const SequenceManager*,
*pointers = get_default_value();
}
else if (MB_SUCCESS != rval_tmp) {
rval = not_found(get_name(), *i);
return MB_TAG_NOT_FOUND;
}
}
......@@ -329,7 +313,9 @@ ErrorCode SparseTag::remove_data(SequenceManager*,
{
ErrorCode rval;
for (size_t i = 0; i < num_entities; ++i) {
rval = remove_data(NULL, entities[i]);MB_CHK_ERR(rval);
rval = remove_data(NULL, entities[i]);
if (MB_SUCCESS != rval)
return rval;
}
return MB_SUCCESS;
......@@ -382,7 +368,7 @@ ErrorCode SparseTag::tag_iterate(SequenceManager* seqman,
// the count can be computed properly
if (get_default_value() && !allocate)
++iter;
return not_found(get_name(), *iter);
// return not_found(get_name(), *iter);
}
// Increment iterator and return
......
......@@ -26,23 +26,6 @@
namespace moab {
inline
static ErrorCode not_found(const std::string& /*name*/, EntityHandle /*h*/)
{
// MB_TAG_NOT_FOUND could be a non-error condition, do not call MB_SET_ERR on it
#if 0
if (h)
fprintf(stderr, "[Warning]: No variable-length sparse tag %s value for %s %lu\n",
name.c_str(),
CN::EntityTypeName(TYPE_FROM_HANDLE(h)),
(unsigned long)ID_FROM_HANDLE(h));
else
fprintf(stderr, "[Warning]: No variable-length sparse tag %s value for root set\n", name.c_str());
#endif
return MB_TAG_NOT_FOUND;
}
VarLenSparseTag::VarLenSparseTag(const char* name,
DataType type,
const void* default_value,
......@@ -82,7 +65,7 @@ ErrorCode VarLenSparseTag::get_data_ptr(Error* /* error */,
length = get_default_value_size();
}
else
return not_found(get_name(), entity_handle);
return MB_TAG_NOT_FOUND;
return MB_SUCCESS;
}
......@@ -117,7 +100,8 @@ ErrorCode VarLenSparseTag::get_data(const SequenceManager*,
ErrorCode rval;
for (size_t i = 0; i < num_entities; ++i) {
rval = get_data_ptr(NULL, entities[i], pointers[i], lengths[i]);MB_CHK_ERR(rval);
rval = get_data_ptr(NULL, entities[i], pointers[i], lengths[i]);
if (rval != MB_SUCCESS) return rval;
}
return MB_SUCCESS;
......@@ -136,7 +120,8 @@ ErrorCode VarLenSparseTag::get_data(const SequenceManager*,
ErrorCode rval;
Range::const_iterator i;
for (i = entities.begin(); i != entities.end(); ++i, ++pointers, ++lengths) {
rval = get_data_ptr(NULL, *i, *pointers, *lengths);MB_CHK_ERR(rval);
rval = get_data_ptr(NULL, *i, *pointers, *lengths);
if (rval != MB_SUCCESS) return rval;
}
return MB_SUCCESS;
......@@ -264,7 +249,7 @@ ErrorCode VarLenSparseTag::remove_data(SequenceManager*,
for (size_t i = 0; i < num_entities; ++i) {
MapType::iterator p = mData.find(entities[i]);
if (p == mData.end())
result = not_found(get_name(), entities[i]);
return MB_TAG_NOT_FOUND;
else {
p->second.clear();
mData.erase(p);
......@@ -282,7 +267,7 @@ ErrorCode VarLenSparseTag::remove_data(SequenceManager*,
for (Range::iterator i = entities.begin(); i != entities.end(); ++i) {
MapType::iterator p = mData.find(*i);
if (p == mData.end())
result = not_found(get_name(), *i);
return MB_TAG_NOT_FOUND;
else {
p->second.clear();
mData.erase(p);
......
......@@ -188,7 +188,7 @@ ErrorCode ReadSTL::ascii_read_triangles(const char* name,
{
FILE* file = fopen(name, "r");
if (!file) {
MB_SET_ERR(MB_FILE_DOES_NOT_EXIST, name << ": " << strerror(errno));
return MB_FILE_DOES_NOT_EXIST;
}
char header[81];
......@@ -198,7 +198,7 @@ ErrorCode ReadSTL::ascii_read_triangles(const char* name,
memcmp(header, "solid", 5) || // Must begin with "solid"
!isspace(header[5])) { // Followed by a whitespace char
fclose(file);
MB_SET_ERR(MB_FILE_WRITE_ERROR, name << ": " << strerror(errno));
return MB_FILE_WRITE_ERROR;
}
// Use tokenizer for remainder of parsing
......@@ -262,14 +262,14 @@ ErrorCode ReadSTL::binary_read_triangles(const char* name,
{
FILE* file = fopen(name, "rb");
if (!file) {
MB_SET_ERR(MB_FILE_DOES_NOT_EXIST, name << ": " << strerror(errno));
return MB_FILE_DOES_NOT_EXIST;
}
// Read header block
BinaryHeader header;
if (fread(&header, 84, 1, file) != 1) {
fclose(file);
MB_SET_ERR(MB_FILE_WRITE_ERROR, name << ": " << strerror(errno));
return MB_FILE_WRITE_ERROR;
}
// Allow user setting for byte order, default to little endian
......@@ -309,7 +309,7 @@ ErrorCode ReadSTL::binary_read_triangles(const char* name,
ULONG_MAX / 50 - 84 < num_tri_swap || // Watch for overflow in next line
84 + 50 * num_tri_swap != (unsigned long)filesize) {
fclose(file);
MB_SET_ERR(MB_FILE_DOES_NOT_EXIST, name << ": not a binary STL file");
return MB_FILE_WRITE_ERROR;
}
swap_bytes = !swap_bytes;
num_tri = num_tri_swap;
......@@ -324,7 +324,7 @@ ErrorCode ReadSTL::binary_read_triangles(const char* name,
for (std::vector<Triangle>::iterator i = tris.begin(); i != tris.end(); ++i) {
if (fread(&tri, 50, 1, file) != 1) {
fclose(file);
MB_SET_ERR(MB_FILE_WRITE_ERROR, name << ": " << strerror(errno));
return MB_FILE_WRITE_ERROR;
}
if (swap_bytes)
......
......@@ -31,14 +31,17 @@
#include "moab/FileOptions.hpp"
#include "FileTokenizer.hpp"
#include "moab/VtkUtil.hpp"
#include "MBTagConventions.hpp"
#define MB_VTK_MATERIAL_SETS
// #define MB_VTK_MATERIAL_SETS
#ifdef MB_VTK_MATERIAL_SETS
#include "MBTagConventions.hpp"
#include <map>
#endif
namespace moab {
#ifdef MB_VTK_MATERIAL_SETS
class Hash
{
public:
......@@ -90,18 +93,19 @@ public:
class Modulator : public std::map<Hash, EntityHandle>
{
public:
Modulator(Interface* iface, std::string tag_name, DataType mb_type, size_t sz, size_t per_elem)
Modulator(Interface* iface) : mesh(iface)
{ }
ErrorCode initialize(std::string tag_name, DataType mb_type, size_t sz, size_t per_elem)
{
this->mesh = iface;
std::vector<unsigned char> default_val;
default_val.resize(sz * per_elem);
ErrorCode rval;
rval = this->mesh->tag_get_handle(
ErrorCode rval = this->mesh->tag_get_handle(
tag_name.c_str(), per_elem, mb_type, this->tag,
MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_CREAT,
&default_val[0]
);
MB_CHK_SET_ERR_RET(rval, "can't tag_get_handle");
return rval;
}
void add_entity(EntityHandle ent, const unsigned char* bytes, size_t len)
......@@ -1032,28 +1036,37 @@ ErrorCode ReadVtk::vtk_read_tag_data(FileTokenizer& tokens,
{
ErrorCode result;
DataType mb_type;
size_t size;
if (type == 1) {
mb_type = MB_TYPE_BIT;
size = sizeof(bool);
}
else if (type >= 2 && type <= 9) {
mb_type = MB_TYPE_INTEGER;
size = sizeof(int);
}
else if (type == 10 || type == 11) {
mb_type = MB_TYPE_DOUBLE;
size = sizeof(double);
}
else if (type == 12) {
mb_type = MB_TYPE_INTEGER;
size = 4; // Could be 4 or 8, but we don't know. Hope it's 4 because MOAB doesn't support 64-bit ints.
}
else
return MB_FAILURE;
#ifdef MB_VTK_MATERIAL_SETS
Modulator materialMap(this->mdbImpl, this->mPartitionTagName, mb_type, size, per_elem);
size_t size;
if (type == 1) {
size = sizeof(bool);
}
else if (type >= 2 && type <= 9) {
size = sizeof(int);
}
else if (type == 10 || type == 11) {
size = sizeof(double);
}
else /* (type == 12) */ {
size = 4; // Could be 4 or 8, but we don't know. Hope it's 4 because MOAB doesn't support 64-bit ints.
}
Modulator materialMap(this->mdbImpl);
result = materialMap.initialize(this->mPartitionTagName, mb_type, size, per_elem);MB_CHK_SET_ERR(result, "MaterialMap tag (" << this->mPartitionTagName << ") creation failed.");
bool isMaterial =
size * per_elem <= 4 && // Must have int-sized values (ParallelComm requires it)
! this->mPartitionTagName.empty() && // Must have a non-empty field name...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment