[cig-commits] r11447 - short/3D/PyLith/trunk/libsrc/bc

brad at geodynamics.org brad at geodynamics.org
Fri Mar 14 15:20:27 PDT 2008


Author: brad
Date: 2008-03-14 15:20:27 -0700 (Fri, 14 Mar 2008)
New Revision: 11447

Modified:
   short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
   short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc
Log:
Added check for overlapping Dirichlet BC.

Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc	2008-03-14 20:42:14 UTC (rev 11446)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc	2008-03-14 22:20:27 UTC (rev 11447)
@@ -212,6 +212,20 @@
     const int_section_type::value_type* offset = 
       _offsetLocal->restrictPoint(*v_iter);
 
+    // Verify other BC has not already constrained DOF
+    const int numPrevious = offset[0];
+    for (int iDOF=0; iDOF < numPrevious; ++iDOF)
+      for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
+	if (allFixedDOF[jDOF] == _fixedDOF[iDOF]) {
+	  std::ostringstream msg;
+	  msg << "Found multiple constraints on degrees of freedom at "
+	      << "point while setting up constraints for DirichletBoundary "
+	      << "boundary condition '" << _label << "'.\n"
+	      << "Degree of freedom " << _fixedDOF[iDOF] 
+	      << " is already constrained by another Dirichlet BC.";
+	  throw std::runtime_error(msg.str());
+	} // if
+
     // Add in the ones for this DirichletBoundary BC
     for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
       allFixedDOF[offset[0]+iDOF] = _fixedDOF[iDOF];

Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc	2008-03-14 20:42:14 UTC (rev 11446)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc	2008-03-14 22:20:27 UTC (rev 11447)
@@ -188,6 +188,20 @@
     // Create array holding all constrained DOF
     int_array allFixedDOF(curFixedDOF, numTotalConstrained);
 
+    // Verify other BC has not already constrained DOF
+    const int numPrevious = _offsetLocal[iPoint];
+    for (int iDOF=0; iDOF < numPrevious; ++iDOF)
+      for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
+	if (allFixedDOF[jDOF] == _fixedDOF[iDOF]) {
+	  std::ostringstream msg;
+	  msg << "Found multiple constraints on degrees of freedom at "
+	      << "point while setting up constraints for DirichletPoints "
+	      << "boundary condition '" << _label << "'.\n"
+	      << "Degree of freedom " << _fixedDOF[iDOF] 
+	      << " is already constrained by another Dirichlet BC.";
+	  throw std::runtime_error(msg.str());
+	} // if
+
     // Add in the ones for this DirichletPoints BC
     for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
       allFixedDOF[_offsetLocal[iPoint]+iDOF] = _fixedDOF[iDOF];



More information about the cig-commits mailing list