Skip to content

Commit 59d0316

Browse files
Nightly Botcwsmith
Nightly Bot
authored andcommitted
Merging develop into master
2 parents c341ecd + 82800ae commit 59d0316

File tree

183 files changed

+768
-298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+768
-298
lines changed

apf/apf.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <cstdio>
2121
#include <cstdlib>
2222
#include <pcu_util.h>
23+
#include <lionPrint.h>
2324

2425
namespace apf {
2526

@@ -353,7 +354,7 @@ double computeCosAngle(Mesh* m, MeshEntity* pe, MeshEntity* e1, MeshEntity* e2,
353354

354355
cosAngle = computeCosAngleInTri(m, pe, e1, e2, Q);
355356
} else {
356-
printf("The requested angle computation is not implemented. Aborting! \n");
357+
lion_oprint(1,"The requested angle computation is not implemented. Aborting! \n");
357358
abort();
358359
}
359360
return cosAngle;
@@ -439,7 +440,7 @@ void sharedReduction(Field* f, Sharing* shr, bool delete_shr,
439440

440441
void fail(const char* why)
441442
{
442-
fprintf(stderr,"APF FAILED: %s\n",why);
443+
lion_eprint(1,"APF FAILED: %s\n",why);
443444
abort();
444445
}
445446

apf/apfConvert.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "apfNumbering.h"
88
#include <map>
99
#include <pcu_util.h>
10+
#include <lionPrint.h>
1011
#include <iostream>
1112
#include <cstdlib>
1213

@@ -247,7 +248,7 @@ class Converter
247248
outMesh->setLongTag(newFromOld[e], out, lngData);
248249
break;
249250
default:
250-
std::cerr << "Tried to convert unknown tag type\n";
251+
lion_eprint(1,"Tried to convert unknown tag type\n");
251252
abort();
252253
break;
253254
}
@@ -329,7 +330,7 @@ class Converter
329330
out = outMesh->createLongTag(tagName, tagSize);
330331
break;
331332
default:
332-
std::cerr << "Tried to convert unknown tag type\n";
333+
lion_eprint(1,"Tried to convert unknown tag type\n");
333334
abort();
334335
}
335336
PCU_DEBUG_ASSERT(out);
@@ -343,7 +344,7 @@ class Converter
343344
if (inMesh->getShape() != getLagrange(2) && inMesh->getShape() != getSerendipity())
344345
return;
345346
if ( ! PCU_Comm_Self())
346-
fprintf(stderr,"transferring quadratic mesh\n");
347+
lion_eprint(1,"transferring quadratic mesh\n");
347348
changeMeshShape(outMesh,inMesh->getShape(),/*project=*/false);
348349
convertField(inMesh->getCoordinateField(),outMesh->getCoordinateField());
349350
}

apf/apfMIS.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <cstdlib>
33
#include "apfMIS.h"
44
#include "apf.h"
5+
#include <lionPrint.h>
56
#include <stdio.h>
67
namespace apf {
78
MIS::MIS(Mesh* mesh, int vtx_dim_, int edge_dim_)
@@ -12,7 +13,7 @@ namespace apf {
1213
MIS* initializeMIS(Mesh* mesh, int vtx_dim, int edge_dim) {
1314
MeshTag* coloring = mesh->findTag("coloring");
1415
if (coloring!=NULL) {
15-
printf("[ERROR] Only one MIS can exist at a time.\n");
16+
lion_oprint(1,"[ERROR] Only one MIS can exist at a time.\n");
1617
return NULL;
1718
}
1819
MIS* mis = new MIS(mesh,vtx_dim,edge_dim);

apf/apfMesh.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "apfTagData.h"
1414
#include <gmi.h>
1515
#include <pcu_util.h>
16+
#include <lionPrint.h>
1617
#include <algorithm>
1718

1819
namespace apf {
@@ -817,11 +818,11 @@ void printTypes(Mesh* m)
817818
m->end(it);
818819
PCU_Add_Longs(typeCnt,Mesh::TYPES);
819820
if (!PCU_Comm_Self()) {
820-
printf("number of");
821+
lion_oprint(1,"number of");
821822
for (int i=0; i<Mesh::TYPES; i++)
822823
if (dim == Mesh::typeDimension[i])
823-
printf(" %s %ld", Mesh::typeName[i], typeCnt[i]);
824-
printf("\n");
824+
lion_oprint(1," %s %ld", Mesh::typeName[i], typeCnt[i]);
825+
lion_oprint(1,"\n");
825826
}
826827
}
827828

@@ -833,7 +834,7 @@ void printStats(Mesh* m)
833834
PCU_Add_Longs(n, 4);
834835
printTypes(m);
835836
if (!PCU_Comm_Self())
836-
printf("mesh entity counts: v %ld e %ld f %ld r %ld\n",
837+
lion_oprint(1,"mesh entity counts: v %ld e %ld f %ld r %ld\n",
837838
n[0], n[1], n[2], n[3]);
838839
}
839840

@@ -844,7 +845,7 @@ void warnAboutEmptyParts(Mesh* m)
844845
++emptyParts;
845846
emptyParts = PCU_Add_Int(emptyParts);
846847
if (emptyParts && (!PCU_Comm_Self()))
847-
fprintf(stderr,"APF warning: %d empty parts\n",emptyParts);
848+
lion_eprint(1,"APF warning: %d empty parts\n",emptyParts);
848849
}
849850

850851
static void getRemotesArray(Mesh* m, MeshEntity* e, CopyArray& a)

apf/apfMigrate.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "apfCavityOp.h"
1111
#include "apf.h"
1212
#include <pcu_util.h>
13+
#include <lionPrint.h>
1314
#include <cstdlib>
1415

1516
namespace apf {
@@ -861,7 +862,7 @@ void setMigrationLimit(size_t maxElements)
861862
{
862863
if( maxElements >= maxMigrationLimit ) {
863864
if(!PCU_Comm_Self())
864-
fprintf(stderr, "ERROR requested migration limit exceeds"
865+
lion_eprint(1, "ERROR requested migration limit exceeds"
865866
" %lu... exiting\n", maxMigrationLimit);
866867
abort();
867868
}

apf/apfVerify.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <sstream>
66
#include <apfGeometry.h>
77
#include <pcu_util.h>
8+
#include <lionPrint.h>
89
#include "stdlib.h" // malloc
910

1011
namespace apf {
@@ -177,7 +178,7 @@ static void verifyUp(Mesh* m, UpwardCounts& guc,
177178
<< upwardCount << " upward adjacencies\n";
178179
// use a stringstream to prevent output from different procs mixing
179180
std::string s = ss.str();
180-
fprintf(stderr,"%s",s.c_str());
181+
lion_eprint(1,"%s",s.c_str());
181182
}
182183
}
183184

@@ -473,7 +474,7 @@ long verifyVolumes(Mesh* m, bool printVolumes)
473474
ss << "warning: element volume " << v
474475
<< " at " << getLinearCentroid(m, e) << '\n';
475476
std::string s = ss.str();
476-
fprintf(stdout, "%s", s.c_str());
477+
lion_oprint(1, "%s", s.c_str());
477478
fflush(stdout);
478479
}
479480
++n;
@@ -724,7 +725,7 @@ static void receiveTagData(Mesh* m, DynamicArray<MeshTag*>& tags)
724725
int global_size = PCU_Max_Int((int)mismatch_tags.size());
725726
if (global_size&&!PCU_Comm_Self())
726727
for (std::set<MeshTag*>::iterator it=mismatch_tags.begin(); it!=mismatch_tags.end(); ++it)
727-
printf(" - tag \"%s\" data mismatch over remote/ghost copies\n", m->getTagName(*it));
728+
lion_oprint(1," - tag \"%s\" data mismatch over remote/ghost copies\n", m->getTagName(*it));
728729
}
729730

730731
static void verifyTags(Mesh* m)
@@ -745,13 +746,13 @@ static void verifyTags(Mesh* m)
745746
{
746747
if (n)
747748
{
748-
printf(" - verifying tags: ");
749+
lion_oprint(1," - verifying tags: ");
749750
for (int i = 0; i < n; ++i)
750751
{
751-
printf("%s", m->getTagName(tags[i]));
752-
if (i<n-1) printf(", ");
752+
lion_oprint(1,"%s", m->getTagName(tags[i]));
753+
if (i<n-1) lion_oprint(1,", ");
753754
}
754-
printf("\n");
755+
lion_oprint(1,"\n");
755756
}
756757
}
757758
PCU_Comm_Send();
@@ -831,13 +832,13 @@ void verify(Mesh* m, bool abort_on_error)
831832
verifyMatches(m);
832833
long n = verifyCoords(m);
833834
if (n && (!PCU_Comm_Self()))
834-
fprintf(stderr,"apf::verify fail: %ld coordinate mismatches\n", n);
835+
lion_eprint(1,"apf::verify fail: %ld coordinate mismatches\n", n);
835836
n = verifyVolumes(m);
836837
if (n && (!PCU_Comm_Self()))
837-
fprintf(stderr,"apf::verify warning: %ld negative simplex elements\n", n);
838+
lion_eprint(1,"apf::verify warning: %ld negative simplex elements\n", n);
838839
double t1 = PCU_Time();
839840
if (!PCU_Comm_Self())
840-
printf("mesh verified in %f seconds\n", t1 - t0);
841+
lion_oprint(1,"mesh verified in %f seconds\n", t1 - t0);
841842
}
842843

843844
}

apf/apfVtk.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <sstream>
1717
#include <fstream>
1818
#include <pcu_util.h>
19+
#include <lionPrint.h>
1920
#include <cstdlib>
2021
#include <stdint.h>
2122
#include <vector>
@@ -896,7 +897,7 @@ static void writeVtuFile(const char* prefix,
896897
double t1 = PCU_Time();
897898
if (!PCU_Comm_Self())
898899
{
899-
printf("writeVtuFile into buffers: %f seconds\n", t1 - t0);
900+
lion_oprint(1,"writeVtuFile into buffers: %f seconds\n", t1 - t0);
900901
}
901902
{ //block forces std::ofstream destructor call
902903
std::ofstream file(fileNameAndPath.c_str());
@@ -906,7 +907,7 @@ static void writeVtuFile(const char* prefix,
906907
double t2 = PCU_Time();
907908
if (!PCU_Comm_Self())
908909
{
909-
printf("writeVtuFile buffers to disk: %f seconds\n", t2 - t1);
910+
lion_oprint(1,"writeVtuFile buffers to disk: %f seconds\n", t2 - t1);
910911
}
911912
}
912913

@@ -961,7 +962,7 @@ void writeVtkFilesRunner(const char* prefix,
961962
double t1 = PCU_Time();
962963
if (!PCU_Comm_Self())
963964
{
964-
printf("vtk files %s written in %f seconds\n", prefix, t1 - t0);
965+
lion_oprint(1,"vtk files %s written in %f seconds\n", prefix, t1 - t0);
965966
}
966967
delete n;
967968
}

crv/crv.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "crvBezier.h"
1010
#include "crvTables.h"
1111
#include "crvQuality.h"
12+
#include <lionPrint.h>
1213
#include <cstdlib>
1314

1415
namespace crv {
@@ -174,7 +175,7 @@ int countNumberInvalidElements(apf::Mesh2* m)
174175

175176
void fail(const char* why)
176177
{
177-
fprintf(stderr,"CRV FAILED: %s\n",why);
178+
lion_eprint(1,"CRV FAILED: %s\n",why);
178179
abort();
179180
}
180181

crv/crvShape.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <PCU.h>
9+
#include <lionPrint.h>
910
#include "crv.h"
1011
#include "crvAdapt.h"
1112
#include "crvShape.h"
@@ -666,13 +667,13 @@ void fixCrvElementShapes(Adapt* a)
666667
/* int numOpSuccess = fixLargeAngles(a); // update this */
667668
/* PCU_Add_Ints(&numOpSuccess,1); */
668669
/* if (PCU_Comm_Self() == 0) */
669-
/* printf("==> %d large angle fix operations succeeded.\n", numOpSuccess); */
670+
/* lion_oprint(1,"==> %d large angle fix operations succeeded.\n", numOpSuccess); */
670671
markCrvBadQuality(a);
671672
fixShortEdgeElements(a); // update this
672673
/* int numEdgeRemoved = fixShortEdgeElements(a); // update this */
673674
/* PCU_Add_Ints(&numEdgeRemoved,1); */
674675
/* if (PCU_Comm_Self() == 0) */
675-
/* printf("==> %d edges removal operations succeeded.\n", numEdgeRemoved); */
676+
/* lion_oprint(1,"==> %d edges removal operations succeeded.\n", numEdgeRemoved); */
676677
count = markCrvBadQuality(a);
677678
++i;
678679
} while(count < prev_count && i < 6); // the second conditions is to make sure this does not take long

crv/crvVtk.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <sstream>
1414
#include <fstream>
1515
#include <pcu_util.h>
16+
#include <lionPrint.h>
1617

1718
// === includes for safe_mkdir ===
1819
#include <reel.h>
@@ -371,7 +372,7 @@ static void writeTriJacobianDet(std::ostream& file, apf::Mesh* m, int n)
371372
ss << "warning: Tri Jacobian Determinant is negative, " << detJ[j]
372373
<< '\n';
373374
std::string s = ss.str();
374-
fprintf(stderr, "%s", s.c_str());
375+
lion_eprint(1, "%s", s.c_str());
375376
isValid = false;
376377
}
377378
maxJ = std::max(detJ[count],maxJ);
@@ -451,7 +452,7 @@ static void writeTetJacobianDet(std::ostream& file, apf::Mesh* m, int n)
451452
ss << "warning: Tet Jacobian Determinant is negative, "
452453
<< detJ[count] << '\n';
453454
std::string s = ss.str();
454-
fprintf(stderr, "%s", s.c_str());
455+
lion_eprint(1, "%s", s.c_str());
455456
isValid = false;
456457
}
457458
maxJ = std::max(detJ[count],maxJ);
@@ -536,7 +537,7 @@ static void writeMinTetJacobianDet(std::ostream& file, apf::Mesh* m, int n)
536537
ss << "warning: Tet Jacobian Determinant is negative, "
537538
<< detJ[count] << '\n';
538539
std::string s = ss.str();
539-
fprintf(stderr, "%s", s.c_str());
540+
lion_eprint(1, "%s", s.c_str());
540541
isValid = false;
541542
}
542543
maxJ = std::max(detJ[count],maxJ);
@@ -1089,7 +1090,7 @@ void writeCurvedVtuFiles(apf::Mesh* m, int type, int n, const char* prefix)
10891090
PCU_Barrier();
10901091
double t1 = PCU_Time();
10911092
if (!PCU_Comm_Self())
1092-
printf("%s vtk files %s written in %f seconds\n",
1093+
lion_oprint(1,"%s vtk files %s written in %f seconds\n",
10931094
apf::Mesh::typeName[type],getPvtuDirectoryStr(prefix, type, n).c_str(),t1 - t0);
10941095
}
10951096

gmi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set(HEADERS
2828

2929
# Add the gmi library
3030
add_library(gmi ${SOURCES})
31-
target_link_libraries(gmi pcu)
31+
target_link_libraries(gmi pcu lion)
3232
target_include_directories(gmi INTERFACE
3333
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
3434
$<INSTALL_INTERFACE:include>

gmi/gmi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
*******************************************************************************/
1010
#include "gmi.h"
11+
#include <lionPrint.h>
1112
#include <stdlib.h>
1213
#include <string.h>
1314
#include <pcu_util.h>
@@ -216,7 +217,7 @@ struct gmi_model* gmi_load(const char* filename)
216217

217218
void gmi_fail(const char* why)
218219
{
219-
fprintf(stderr,"gmi failed: %s\n",why);
220+
lion_eprint(1,"gmi failed: %s\n",why);
220221
abort();
221222
}
222223

lion/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (LION_COMPRESS)
88
endif()
99

1010
# Package sources
11-
set(SOURCES lionBase64.cc)
11+
set(SOURCES lionBase64.cc lionPrint.c)
1212
if(LION_COMPRESS)
1313
set(SOURCES ${SOURCES} lionZLib.cc)
1414
else()
@@ -19,6 +19,7 @@ endif()
1919
set(HEADERS
2020
lionBase64.h
2121
lionCompress.h
22+
lionPrint.h
2223
)
2324

2425
# Add the lion Library

0 commit comments

Comments
 (0)